Skip to content

Error when test is extended to create a browser fixture #172

Open
@guxx0014

Description

@guxx0014

I have extended test from playwright-test-coverage to define a browser fixture. But I run into an error:

    Error: page.evaluate: TypeError: callbacks.set is not a function
    
        at <anonymous>:24:64
        at new Promise (<anonymous>)
        at globalThis.<computed> (<anonymous>:24:21)
        at eval (eval at evaluate (:234:30), <anonymous>:2:16)
        at UtilityScript.evaluate (<anonymous>:236:17)
        at UtilityScript.<anonymous> (<anonymous>:1:44)

I found that it can be avoided by just adding a closure to the callback function of page.evaluate:

await page.evaluate(() => {
    window.collectIstanbulCoverage(JSON.stringify(window.__coverage__));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions