@web/test-runner-playwright
Advanced tools
Comparing version 0.4.20 to 0.4.21
# @web/test-runner-playwright | ||
## 0.4.21 | ||
### Patch Changes | ||
- d77093b: allow code coverage instrumentation through JS | ||
- Updated dependencies [d77093b] | ||
- @web/test-runner-core@0.6.23 | ||
## 0.4.20 | ||
@@ -4,0 +12,0 @@ |
@@ -38,3 +38,7 @@ "use strict"; | ||
async runSession(url, coverage) { | ||
if (coverage && !this.coverageEnabled && this.playwrightPage.coverage) { | ||
var _a; | ||
if (coverage && | ||
!this.coverageEnabled && | ||
this.playwrightPage.coverage && | ||
((_a = this.config.coverageConfig) === null || _a === void 0 ? void 0 : _a.nativeInstrumentation) !== false) { | ||
this.coverageEnabled = true; | ||
@@ -58,4 +62,15 @@ await this.playwrightPage.coverage.startJSCoverage(); | ||
async collectTestCoverage(config, testFiles) { | ||
var _a, _b; | ||
const coverage = ((_b = (await ((_a = this.playwrightPage.coverage) === null || _a === void 0 ? void 0 : _a.stopJSCoverage()))) !== null && _b !== void 0 ? _b : []); | ||
var _a, _b, _c; | ||
if (((_a = config.coverageConfig) === null || _a === void 0 ? void 0 : _a.nativeInstrumentation) !== false) { | ||
// get coverage from the browser, generated by JS | ||
const coverageFromBrowser = await this.playwrightPage.evaluate(() => window.__coverage__); | ||
if (!coverageFromBrowser) { | ||
throw new Error('Coverage is enabled with nativeInstrumentation disabled. ' + | ||
'Expected coverage provided in the browser as a global __coverage__ variable.' + | ||
'Use a plugin like babel-plugin-istanbul to generate the coverage, or enable native instrumentation.'); | ||
} | ||
return coverageFromBrowser; | ||
} | ||
// get native coverage from playwright | ||
const coverage = ((_c = (await ((_b = this.playwrightPage.coverage) === null || _b === void 0 ? void 0 : _b.stopJSCoverage()))) !== null && _c !== void 0 ? _c : []); | ||
this.coverageEnabled = false; | ||
@@ -62,0 +77,0 @@ return test_runner_coverage_v8_1.v8ToIstanbul(config, testFiles, coverage); |
{ | ||
"name": "@web/test-runner-playwright", | ||
"version": "0.4.20", | ||
"version": "0.4.21", | ||
"publishConfig": { | ||
@@ -38,3 +38,3 @@ "access": "public" | ||
"@web/browser-logs": "^0.0.1", | ||
"@web/test-runner-core": "^0.6.22", | ||
"@web/test-runner-core": "^0.6.23", | ||
"@web/test-runner-coverage-v8": "^0.0.4", | ||
@@ -41,0 +41,0 @@ "playwright": "^1.3.0" |
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
30402
266