Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred while trying to read the map file #197

Open
eliw00d opened this issue Aug 25, 2022 · 1 comment
Open

An error occurred while trying to read the map file #197

eliw00d opened this issue Aug 25, 2022 · 1 comment

Comments

@eliw00d
Copy link

eliw00d commented Aug 25, 2022

I'm trying to get this to work with Playwright + Electron and have the following:

test.beforeAll(async () => {
    page = await electronApp.firstWindow()
    await page.coverage.startJSCoverage()
})

test.afterAll(async () => {
    const coverage = await page.coverage.stopJSCoverage()
    for (const entry of coverage) {
      const converter = v8toIstanbul('', 0, { source: entry.source! })
      await converter.load()
      converter.applyCoverage(entry.functions)
      console.log(JSON.stringify(converter.toIstanbul()))
    }
})

My project is set up with Electron Forge, so it uses Webpack and TypeScript.

It works for one test but another throws the following error:

Error: An error occurred while trying to read the map file at /Users/eliw00d/projects/myProject/index.js.map
Error: ENOENT: no such file or directory, open '/Users/eliw00d/projects/myProject/index.js.map'
    at readFromFileMap (/Users/eliw00d/projects/myProject/node_modules/convert-source-map/index.js:40:11)
    at new Converter (/Users/eliw00d/projects/myProject/node_modules/convert-source-map/index.js:47:32)
    at Object.exports.fromMapFileComment (/Users/eliw00d/projects/myProject/node_modules/convert-source-map/index.js:110:10)
    at Object.exports.fromMapFileSource (/Users/eliw00d/projects/myProject/node_modules/convert-source-map/index.js:122:22)
    at V8ToIstanbul.load (/Users/eliw00d/projects/myProject/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:52:66)
    at TestInfoImpl._runAsStep (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/testInfo.js:201:22)
    at /Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/workerRunner.js:655:9
    at TestInfoImpl._runFn (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/testInfo.js:166:7)
    at WorkerRunner._runAfterAllHooksForSuite (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/workerRunner.js:642:29)
    at /Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/workerRunner.js:499:33
    at TimeoutRunner.run (/Users/eliw00d/projects/myProject/node_modules/playwright-core/lib/utils/timeoutRunner.js:53:14)
    at TimeoutManager.runWithTimeout (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/timeoutManager.js:73:7)
    at TestInfoImpl._runWithTimeout (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/testInfo.js:154:26)
    at WorkerRunner._runTest (/Users/eliw00d/projects/myProject/node_modules/@playwright/test/lib/workerRunner.js:464:5)

Which points to: https://github.com/istanbuljs/v8-to-istanbul/blob/master/lib/v8-to-istanbul.js#L52

I have "sourceMap": true in my tsconfig.json so I'm not sure what's going on here. Any thoughts?

@testgitdl
Copy link

I have the same problem. Any idea on how to solve? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants