Skip to content

Commit

Permalink
chore: fix coverage on WebKit
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed May 25, 2022
1 parent 0acffa8 commit d59b012
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PlaywrightEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ export const getPlaywrightEnv = (basicEnv = 'node'): unknown => {
}

async _setCollectCoverage(context: BrowserContext) {
await context.exposeFunction('reportCodeCoverage', saveCoverageToFile)
await context.exposeFunction(
'reportCodeCoverage',
(coverage: unknown) => {
if (coverage) saveCoverageToFile(coverage)
},
)
await context.addInitScript(() =>
window.addEventListener('beforeunload', () => {
// @ts-ignore
Expand Down

0 comments on commit d59b012

Please sign in to comment.