playwright-coverage icon indicating copy to clipboard operation
playwright-coverage copied to clipboard

Cannot read property 'trimEnd' of null in v8-to-istanbul

Open scottfwalter opened this issue 3 years ago • 1 comments

When I run against my app I get the following exception:

TypeError: Cannot read property 'trimEnd' of null
    at new CovSource (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/v8-to-istanbul/lib/source.js:6:27)
    at /Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:54:90
    at Array.map (<anonymous>)
    at V8ToIstanbul.load (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:54:57)
    at convertToIstanbulCoverage (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/@bgotink/playwright-coverage/src/data.ts:183:5)
    at CoverageReporter.onEnd (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/@bgotink/playwright-coverage/src/reporter.ts:73:30)
    at Multiplexer.onEnd (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/@playwright/test/lib/test/reporters/multiplexer.js:73:7)
    at Runner._run (/Users/scott/cxone/apps/cxone-hybrid-webapp-boilerplate/node_modules/@playwright/test/lib/test/runner.js:363:7)

I will try to dig into it but wanted you to be aware. If you feel there's anything I can provide to help debug this then don't hesitate to let me know.

scottfwalter avatar Sep 20 '21 19:09 scottfwalter

If I understand the code in these dependencies correctly, it appears that the sourceMap has a null in the sourcesContent array.

According to the sourcemap spec, that's allowed:

[sourcesContent is] an optional list of source content, useful when the “source” can’t be hosted. The contents are listed in the same order as the sources in line 5. “null” may be used if some original sources should be retrieved by name.

Would it be possible for you to take a look at the generated source maps to check if there is indeed one that has a null in sourcesContent? If there is, I'd love to know if there's anything special about the item at the same index in the source map's sources array. That array contains the names of the sources, so I'm very curious to see which source can't be inlined.

bgotink avatar Sep 20 '21 20:09 bgotink