@web/test-runner-playwright
Advanced tools
Comparing version 0.4.0 to 0.4.1
# @web/test-runner-playwright | ||
## 0.4.1 | ||
### Patch Changes | ||
- 3dab600: profile test coverage through v8/chromium | ||
- Updated dependencies [3dab600] | ||
- @web/test-runner-core@0.6.2 | ||
- @web/test-runner-coverage-v8@0.0.1 | ||
## 0.4.0 | ||
@@ -4,0 +13,0 @@ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const playwright_1 = __importDefault(require("playwright")); | ||
const test_runner_coverage_v8_1 = require("@web/test-runner-coverage-v8"); | ||
const validBrowserTypes = ['chromium', 'firefox', 'webkit']; | ||
@@ -15,2 +16,4 @@ function playwrightLauncher({ browserTypes = ['chromium'], } = {}) { | ||
const inactivePages = []; | ||
let config; | ||
let testFiles; | ||
if (browserTypes.some(t => !validBrowserTypes.includes(t))) { | ||
@@ -20,3 +23,5 @@ throw new Error(`Invalid browser types: ${browserTypes}. Valid browser types: ${validBrowserTypes.join(', ')}`); | ||
return { | ||
async start() { | ||
async start(_config, _testFiles) { | ||
config = _config; | ||
testFiles = _testFiles; | ||
const browserNames = []; | ||
@@ -44,2 +49,3 @@ for (const type of browserTypes) { | ||
async startSession(session, url) { | ||
var _a; | ||
const browser = browsers.get(session.browserName); | ||
@@ -60,2 +66,5 @@ if (!browser) { | ||
activePages.set(session.id, page); | ||
if (config.coverage) { | ||
await ((_a = page.coverage) === null || _a === void 0 ? void 0 : _a.startJSCoverage()); | ||
} | ||
await page.goto(url); | ||
@@ -70,2 +79,17 @@ }, | ||
}, | ||
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; | ||
}, | ||
async startDebugSession(session, url) { | ||
@@ -72,0 +96,0 @@ const browserType = session.browserName.toLowerCase(); |
{ | ||
"name": "@web/test-runner-playwright", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"publishConfig": { | ||
@@ -39,9 +39,10 @@ "access": "public" | ||
"dependencies": { | ||
"@web/test-runner-core": "^0.6.0", | ||
"playwright": "1.0.2" | ||
"@web/test-runner-core": "^0.6.2", | ||
"@web/test-runner-coverage-v8": "^0.0.1", | ||
"playwright": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@web/test-runner-mocha": "^0.2.5", | ||
"@web/test-runner-server": "^0.5.0" | ||
"@web/test-runner-server": "^0.5.6" | ||
} | ||
} |
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
12382
111
3
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/picomatch@2.3.4(transitive)
+ Added@web/test-runner-coverage-v8@0.0.1(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedfsevents@2.3.2(transitive)
+ Addedplaywright@1.48.2(transitive)
+ Addedplaywright-core@1.48.2(transitive)
+ Addedsource-map@0.7.4(transitive)
+ Addedv8-to-istanbul@4.1.4(transitive)
- Removedplaywright@1.0.2(transitive)
Updated@web/test-runner-core@^0.6.2
Updatedplaywright@^1.2.0