Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('\x1b[34m');
}
console.log(str);
if (str.trim() == '# ok') {
console.log('\x1b[32m' + 'SUCCESS!');
setTimeout(() => process.exit(0), 100);
}
}
});
// navigate to unit test page
await page.goto('http://127.0.0.1:1234/');
// disable coverage
const jsCoverage = await page.coverage.stopJSCoverage();
pup2ist.write([...jsCoverage]);
await new Promise(resolve => setTimeout(resolve, 6000));
await browser.close();
})();
console.log('\x1b[34m');
}
console.log(str);
if (str.trim() == '# ok') {
console.log('\x1b[32m' + 'SUCCESS!');
setTimeout(() => process.exit(0), 100);
}
}
});
// navigate to unit test page
await page.goto('http://127.0.0.1:1234/docs/test.html');
// disable coverage
const jsCoverage = await page.coverage.stopJSCoverage();
pup2ist.write([...jsCoverage]);
await new Promise(resolve => setTimeout(resolve, 6000));
await browser.close();
})();
public async close() {
try {
const pti = require('puppeteer-to-istanbul');
const [jsCoverage, cssCoverage] = await Promise.all([
this.page.coverage.stopJSCoverage(),
this.page.coverage.stopCSSCoverage(),
]);
pti.write(jsCoverage);
pti.write(cssCoverage);
return await this.browser.close();
} catch (Exception) /* istanbul ignore next */ {
throw new Error(Exception.toString());
}
}
}
public async close() {
try {
const pti = require('puppeteer-to-istanbul');
const [jsCoverage, cssCoverage] = await Promise.all([
this.page.coverage.stopJSCoverage(),
this.page.coverage.stopCSSCoverage(),
]);
pti.write(jsCoverage);
pti.write(cssCoverage);
return await this.browser.close();
} catch (Exception) /* istanbul ignore next */ {
throw new Error(Exception.toString());
}
}
}
console.log("\n");
}
}
}
}
console.log(`\nRan ${results.testCounts.total} tests (${numAssertions} assertions)...\n`);
const passed = results.status === "passed";
if (passed) {
console.log("\u001b[32mAll tests passed!\u001b[0m\n");
} else {
console.log(`\t\u001b[31m${results.testCounts.failed} tests failed.\u001b[0m\n\n`);
}
const jsCoverage = await page.coverage.stopJSCoverage();
pti.write(jsCoverage.filter(s => s.url.match(FILTER_REGEX)));
await server.close();
await browser.close();
process.exit(passed ? 0 : 1);
});