mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-06 16:02:27 +03:00
refine browser testing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const PuppeteerEnvironment = require('jest-environment-puppeteer');
|
||||
const pti = require('puppeteer-to-istanbul');
|
||||
// const pti = require('puppeteer-to-istanbul');
|
||||
const { setupRollupTest, cleanupRollupTest } = require('./jest-puppeteer.rollup.js');
|
||||
|
||||
class PuppeteerRollupEnvironment extends PuppeteerEnvironment {
|
||||
@@ -22,9 +22,9 @@ class PuppeteerRollupEnvironment extends PuppeteerEnvironment {
|
||||
|
||||
async teardown() {
|
||||
// coverage
|
||||
const { page } = this.global;
|
||||
const [jsCoverage, cssCoverage] = await Promise.all([page.coverage.stopJSCoverage(), page.coverage.stopCSSCoverage()]);
|
||||
pti.write([...jsCoverage, ...cssCoverage], { includeHostname: true, storagePath: './.pptr' });
|
||||
// const { page } = this.global;
|
||||
// const [jsCoverage, cssCoverage] = await Promise.all([page.coverage.stopJSCoverage(), page.coverage.stopCSSCoverage()]);
|
||||
// pti.write([...jsCoverage, ...cssCoverage], { includeHostname: true, storagePath: './.pptr' });
|
||||
|
||||
// cleanup
|
||||
cleanupRollupTest(this.ctx.testPath, this.cfg.cache);
|
||||
|
||||
@@ -87,20 +87,6 @@ const genHtmlTemplateFunc = (content) => ({ attributes, files, meta, publicPath,
|
||||
${content || ''}
|
||||
${scripts}
|
||||
<div id="testResult"></div>
|
||||
<script>
|
||||
var testResultElm = document.getElementById('testResult');
|
||||
window.setTestResult = function(result) {
|
||||
if (typeof result === 'boolean') {
|
||||
testResultElm.setAttribute('class', result ? 'passed' : 'failed');
|
||||
}
|
||||
else {
|
||||
testResultElm.removeAttribute('class');
|
||||
}
|
||||
};
|
||||
window.testPassed = function() {
|
||||
return testResultElm.getAttribute('class') === 'passed';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user