diff --git a/.changeset/tidy-knives-agree.md b/.changeset/tidy-knives-agree.md new file mode 100644 index 000000000..5e91490a6 --- /dev/null +++ b/.changeset/tidy-knives-agree.md @@ -0,0 +1,5 @@ +--- +'@web/test-runner-playwright': patch +--- + +Support browser generated coverage without native instrumentation diff --git a/packages/test-runner-playwright/src/PlaywrightLauncherPage.ts b/packages/test-runner-playwright/src/PlaywrightLauncherPage.ts index fa4de283a..98dd3e84a 100644 --- a/packages/test-runner-playwright/src/PlaywrightLauncherPage.ts +++ b/packages/test-runner-playwright/src/PlaywrightLauncherPage.ts @@ -44,9 +44,7 @@ export class PlaywrightLauncherPage { } async stopSession(): Promise { - const testCoverage = this.nativeInstrumentationEnabledOnPage - ? await this.collectTestCoverage(this.config, this.testFiles) - : undefined; + const testCoverage = await this.collectTestCoverage(this.config, this.testFiles); // navigate to an empty page to kill any running code on the page, stopping timers and // breaking a potential endless reload loop @@ -82,6 +80,10 @@ export class PlaywrightLauncherPage { ); } + if (!this.nativeInstrumentationEnabledOnPage) { + return undefined; + } + // get native coverage from playwright let coverage: V8Coverage[]; if (this.product === 'chromium') {