How to use @hint/utils-create-server - 2 common examples

To help you get started, we’ve selected a few @hint/utils-create-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webhintio / hint / packages / utils-tests-helpers / src / hint-runner.ts View on Github external
engine = await createConnector(t, hintTest, connector);
            const results = await engine.executeOn(new URL(target));

            const sources = new Map();

            for (const result of results) {
                if (!sources.has(result.resource)) {
                    sources.set(result.resource, await requestSource(result.resource, connector));
                }
            }

            await stopConnector(hintTest, engine);
            await server.stop();

            return validateResults(t, sources, results, Server.updateLocalhost(reports, server.port));
        } catch (e) {
            console.error(e);

            if (server) {
                await server.stop();
            }

            if (engine) {
                await engine.close();
            }

            return t.fail(`${hintTest.name} throwed an exception:\n${e.message}\n${e.stack}`);
        }
    };
github webhintio / hint / packages / utils-tests-helpers / src / hint-runner.ts View on Github external
const runHint = async (t: ExecutionContext, hintTest: HintTest, connector: string) => {
        let engine,
            server;

        try {
            server = await Server.create({ configuration: hintTest.serverConfig, isHTTPS: configs.https });

            const { serverUrl, reports } = hintTest;
            const target = serverUrl ? serverUrl : `${configs.https ? 'https' : 'http'}://localhost:${server.port}/`;

            engine = await createConnector(t, hintTest, connector);
            const results = await engine.executeOn(new URL(target));

            const sources = new Map();

            for (const result of results) {
                if (!sources.has(result.resource)) {
                    sources.set(result.resource, await requestSource(result.resource, connector));
                }
            }

            await stopConnector(hintTest, engine);

@hint/utils-create-server

hint create server util

Apache-2.0
Latest version published 2 months ago

Package Health Score

90 / 100
Full package analysis