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') {