You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting a Cannot read property 'source' of undefined error when trying to process a file compressed.min.js which has the following compressed.js.map. All the sources are in the same directory.
(node:79066) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'source' of undefined
at V8ToIstanbul._maybeRemapStartColEndCol (/project/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:188:40)
at /project/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:110:60
at Array.forEach (<anonymous>)
at /project/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:109:20
at Array.forEach (<anonymous>)
at V8ToIstanbul.applyCoverage (/project/node_modules/v8-to-istanbul/lib/v8-to-istanbul.js:108:12)
However, if I include the "sourcesContent", for example:
{
"version": 3,
"file": "compressed.min.js",
"sources": [
"widget.js",
"plugin.js",
"app.js"
],
"names": [
"Widget",
"console",
"log",
"Plugin",
"window",
"onload"
],
"sourcesContent": [
"var Widget = (function () {\n // Constructor\n var Widget = function () {\n console.log(\"Logged from widget.js\");\n };\n\n // Export Widget.\n return Widget;\n})();",
"var Plugin = (function () {\n // Constructor\n var Plugin = function () {\n console.log(\"Logged from plugin.js\");\n };\n\n // Export Plugin.\n return Plugin;\n})();",
"window.onload = function () {\n console.log(\"This was logged from the app.js file.\");\n\n var widget = new Widget();\n\n var plugin = new Plugin();\n};"
],
"mappings": "AAAA,GAAIA,QAAS,WAGX,GAAIA,GAAS,WACXC,QAAQC,IAAI,yBAId,OAAOF,MCRLG,OAAS,WAGX,GAAIA,GAAS,WACXF,QAAQC,IAAI,yBAId,OAAOC,KCRTC,QAAOC,OAAS,WACfJ,QAAQC,IAAI,wCAEC,IAAIF,QAEJ,GAAIG"
}
Then the instanbul report is generated successfully.
Hi,
I'm getting a
Cannot read property 'source' of undefined
error when trying to process a filecompressed.min.js
which has the followingcompressed.js.map
. All the sources are in the same directory.Full Error below:
However, if I include the "sourcesContent", for example:
Then the instanbul report is generated successfully.
The following also works:
After some debugging:
If I change the following line (https://github.com/istanbuljs/v8-to-istanbul/blob/master/lib/v8-to-istanbul.js#L51)
to
false
, so that it fetches the files from disk, then it all seems ok :)Potentially the
this.rawSourceMap.sourcemap.sources.length > 1
should also check thatsourcesContent
is defined for each of the sources?Thanks!
The text was updated successfully, but these errors were encountered: