@web/test-runner-playwright
Advanced tools
Comparing version 0.4.1 to 0.4.2
# @web/test-runner-playwright | ||
## 0.4.2 | ||
### Patch Changes | ||
- 5ab18d8: feat(test-runner-core): batch v8 test coverage | ||
- Updated dependencies [5ab18d8] | ||
- @web/test-runner-core@0.6.4 | ||
## 0.4.1 | ||
@@ -4,0 +12,0 @@ |
@@ -10,2 +10,7 @@ "use strict"; | ||
const validBrowserTypes = ['chromium', 'firefox', 'webkit']; | ||
async function getPageCoverage(config, testFiles, page) { | ||
var _a, _b; | ||
const coverage = ((_b = (await ((_a = page.coverage) === null || _a === void 0 ? void 0 : _a.stopJSCoverage()))) !== null && _b !== void 0 ? _b : []); | ||
return test_runner_coverage_v8_1.v8ToIstanbul(config, testFiles, coverage); | ||
} | ||
function playwrightLauncher({ browserTypes = ['chromium'], } = {}) { | ||
@@ -58,2 +63,5 @@ const browsers = new Map(); | ||
page = await browser.newPage(); | ||
if (config.coverage) { | ||
await ((_a = page.coverage) === null || _a === void 0 ? void 0 : _a.startJSCoverage()); | ||
} | ||
} | ||
@@ -64,5 +72,2 @@ else { | ||
activePages.set(session.id, page); | ||
if (config.coverage) { | ||
await ((_a = page.coverage) === null || _a === void 0 ? void 0 : _a.startJSCoverage()); | ||
} | ||
await page.goto(url); | ||
@@ -77,16 +82,4 @@ }, | ||
}, | ||
async getTestCoverage(session) { | ||
var _a, _b; | ||
const page = activePages.get(session.id); | ||
if (!page) { | ||
throw new Error(`No page for session ${session.id}`); | ||
} | ||
let istanbulCoverage = undefined; | ||
if (config.coverage) { | ||
const coverage = ((_b = (await ((_a = page.coverage) === null || _a === void 0 ? void 0 : _a.stopJSCoverage()))) !== null && _b !== void 0 ? _b : []); | ||
istanbulCoverage = await test_runner_coverage_v8_1.v8ToIstanbul(config, testFiles, coverage); | ||
} | ||
activePages.delete(session.id); | ||
inactivePages.push(page); | ||
return istanbulCoverage; | ||
getTestCoverage() { | ||
return Promise.all(inactivePages.map(page => getPageCoverage(config, testFiles, page))); | ||
}, | ||
@@ -93,0 +86,0 @@ async startDebugSession(session, url) { |
{ | ||
"name": "@web/test-runner-playwright", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"publishConfig": { | ||
@@ -39,3 +39,3 @@ "access": "public" | ||
"dependencies": { | ||
"@web/test-runner-core": "^0.6.2", | ||
"@web/test-runner-core": "^0.6.4", | ||
"@web/test-runner-coverage-v8": "^0.0.1", | ||
@@ -46,4 +46,4 @@ "playwright": "^1.2.0" | ||
"@web/test-runner-mocha": "^0.2.5", | ||
"@web/test-runner-server": "^0.5.6" | ||
"@web/test-runner-server": "^0.5.7" | ||
} | ||
} |
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
12079
104
Updated@web/test-runner-core@^0.6.4