@web/test-runner-chrome
Advanced tools
Comparing version 0.5.5 to 0.5.6
# @web/test-runner-chrome | ||
## 0.5.6 | ||
### Patch Changes | ||
- 4a6b9c2: make coverage work in watch mode | ||
## 0.5.5 | ||
@@ -4,0 +10,0 @@ |
@@ -27,2 +27,5 @@ "use strict"; | ||
const inactivePages = []; | ||
// puppeteer does not indicate whether coverage is enabled, so we track it here | ||
const pagesWithCoverageEnabled = new WeakSet(); | ||
const cachedCoverage = new WeakMap(); | ||
let browser; | ||
@@ -62,5 +65,2 @@ let debugBrowser = undefined; | ||
page = await browser.newPage(); | ||
if (config.coverage) { | ||
await page.coverage.startJSCoverage(); | ||
} | ||
} | ||
@@ -70,2 +70,7 @@ else { | ||
} | ||
if (config.coverage && !pagesWithCoverageEnabled.has(page)) { | ||
pagesWithCoverageEnabled.add(page); | ||
cachedCoverage.delete(page); | ||
await page.coverage.startJSCoverage(); | ||
} | ||
activePages.set(session.id, page); | ||
@@ -83,3 +88,12 @@ await page.setViewport({ height: 600, width: 800 }); | ||
getTestCoverage() { | ||
return Promise.all(inactivePages.map(page => getPageCoverage(config, testFiles, page))); | ||
return Promise.all(inactivePages.map(page => { | ||
if (pagesWithCoverageEnabled.has(page)) { | ||
pagesWithCoverageEnabled.delete(page); | ||
return getPageCoverage(config, testFiles, page).then(coverage => { | ||
cachedCoverage.set(page, coverage); | ||
return coverage; | ||
}); | ||
} | ||
return cachedCoverage.get(page); | ||
})); | ||
}, | ||
@@ -86,0 +100,0 @@ async startDebugSession(session, url) { |
{ | ||
"name": "@web/test-runner-chrome", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17439
173