-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Cannot read properties of undefined (reading 'endCol') #198
Comments
@jridgewell can you tell if we're making wrong assumptions about source map shape here? |
I'd need a proper reproduction repo to fully debug. Or, if you could provide me with the arguments passed to the My initial thought is that we're hitting one of the unmapped regions in the map (everything that's not highlighted). If that's the case, then we do return an all-null |
Here is the full {
"sourceMap": {"version":3,"file":"/workspace/src/utils/function.ts","names":["noop","noopSync","Promise","resolve"],"sources":["/workspace/src/utils/function.ts"],"sourcesContent":["export const noop = () => Promise.resolve();\nexport const noopSync = () => {\n /* noop */\n};\n"],"resolvedSources":["/workspace/src/utils/function.ts"],"_encoded":"AAAA;;;;;;;;;;;IAAaA,IAAI,MAAJA;IACAC,QAAQ,MAARA;;AADN,MAAMD,OAAO,IAAME,QAAQC,OAAO;AAClC,MAAMF,WAAW,IAAM;AAC5B,QAAQ,GACV","_decoded":[[[0,0,0,0]],[],[],[],[],[],[],[],[],[],[],[[4,0,0,13,0],[8,0,0,17],[14,0,0,13,0]],[[4,0,1,13,1],[12,0,1,21],[18,0,1,13,1]],[],[[0,0,0,7],[6,0,0,13,0],[13,0,0,20],[17,0,0,26,2],[25,0,0,34,3],[32,0,0,41]],[[0,0,1,7],[6,0,1,13,1],[17,0,1,24],[21,0,1,30]],[[0,0,2,2],[8,0,2,10],[11,0,3,0]]],"_decodedMemo":{"lastKey":5,"lastNeedle":0,"lastIndex":-1}},
"startCol": 263,
"endCol": 271,
"this": {"lines":[{"line":1,"startCol":0,"endCol":13,"count":1,"ignore":false},{"line":2,"startCol":14,"endCol":60,"count":1,"ignore":false},{"line":3,"startCol":61,"endCol":76,"count":1,"ignore":false},{"line":4,"startCol":77,"endCol":80,"count":1,"ignore":false},{"line":5,"startCol":81,"endCol":112,"count":1,"ignore":false},{"line":6,"startCol":113,"endCol":174,"count":1,"ignore":false},{"line":7,"startCol":175,"endCol":200,"count":1,"ignore":false},{"line":8,"startCol":201,"endCol":223,"count":1,"ignore":false},{"line":9,"startCol":224,"endCol":231,"count":1,"ignore":false},{"line":10,"startCol":232,"endCol":233,"count":1,"ignore":false},{"line":11,"startCol":234,"endCol":252,"count":1,"ignore":false},{"line":12,"startCol":253,"endCol":272,"count":1,"ignore":false},{"line":13,"startCol":273,"endCol":299,"count":1,"ignore":false},{"line":14,"startCol":300,"endCol":303,"count":1,"ignore":false},{"line":15,"startCol":304,"endCol":339,"count":1,"ignore":false},{"line":16,"startCol":340,"endCol":362,"count":1,"ignore":false},{"line":17,"startCol":363,"endCol":376,"count":1,"ignore":false},{"line":18,"startCol":377,"endCol":377,"count":1,"ignore":false},{"line":19,"startCol":378,"endCol":944,"count":1,"ignore":false}],"eof":944,"shebangLength":0,"wrapperLength":77}
} |
Sorry, I'm still missing the |
Previously I sent {"path":"/workspace/src/utils/function.ts","wrapperLength":77,"sources":{"originalSource":"export const noop = () => Promise.resolve();\nexport const noopSync = () => {\n /* noop */\n};\n","source":"\"use strict\";\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nfunction _export(target, all) {\n for(var name in all)Object.defineProperty(target, name, {\n enumerable: true,\n get: all[name]\n });\n}\n_export(exports, {\n noop: ()=>noop,\n noopSync: ()=>noopSync\n});\nconst noop = ()=>Promise.resolve();\nconst noopSync = ()=>{\n/* noop */ };\n\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi93b3Jrc3BhY2Uvc3JjL3V0aWxzL2Z1bmN0aW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBub29wID0gKCkgPT4gUHJvbWlzZS5yZXNvbHZlKCk7XG5leHBvcnQgY29uc3Qgbm9vcFN5bmMgPSAoKSA9PiB7XG4gIC8qIG5vb3AgKi9cbn07XG4iXSwibmFtZXMiOlsibm9vcCIsIm5vb3BTeW5jIiwiUHJvbWlzZSIsInJlc29sdmUiXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7OztJQUFhQSxJQUFJLE1BQUpBO0lBQ0FDLFFBQVEsTUFBUkE7O0FBRE4sTUFBTUQsT0FBTyxJQUFNRSxRQUFRQyxPQUFPO0FBQ2xDLE1BQU1GLFdBQVcsSUFBTTtBQUM1QixRQUFRLEdBQ1YifQ==","sourceMap":{"sourcemap":{"file":"/workspace/src/utils/function.ts","version":3,"sources":["/workspace/src/utils/function.ts"],"sourcesContent":["export const noop = () => Promise.resolve();\nexport const noopSync = () => {\n /* noop */\n};\n"],"names":["noop","noopSync","Promise","resolve"],"mappings":"AAAA;;;;;;;;;;;IAAaA,IAAI,MAAJA;IACAC,QAAQ,MAARA;;AADN,MAAMD,OAAO,IAAME,QAAQC,OAAO;AAClC,MAAMF,WAAW,IAAM;AAC5B,QAAQ,GACV"}}},"generatedLines":[],"branches":{},"functions":{},"covSources":[{"source":{"lines":[{"line":1,"startCol":0,"endCol":44,"count":1,"ignore":false},{"line":2,"startCol":45,"endCol":76,"count":1,"ignore":false},{"line":3,"startCol":77,"endCol":89,"count":1,"ignore":false},{"line":4,"startCol":90,"endCol":92,"count":1,"ignore":false}],"eof":92,"shebangLength":0,"wrapperLength":77},"path":"/workspace/src/utils/function.ts"}],"rawSourceMap":{"sourcemap":{"file":"/workspace/src/utils/function.ts","version":3,"sources":["/workspace/src/utils/function.ts"],"sourcesContent":["export const noop = () => Promise.resolve();\nexport const noopSync = () => {\n /* noop */\n};\n"],"names":["noop","noopSync","Promise","resolve"],"mappings":"AAAA;;;;;;;;;;;IAAaA,IAAI,MAAJA;IACAC,QAAQ,MAARA;;AADN,MAAMD,OAAO,IAAME,QAAQC,OAAO;AAClC,MAAMF,WAAW,IAAM;AAC5B,QAAQ,GACV"}},"sourceMap":{"version":3,"file":"/workspace/src/utils/function.ts","names":["noop","noopSync","Promise","resolve"],"sources":["/workspace/src/utils/function.ts"],"sourcesContent":["export const noop = () => Promise.resolve();\nexport const noopSync = () => {\n /* noop */\n};\n"],"resolvedSources":["/workspace/src/utils/function.ts"],"_encoded":"AAAA;;;;;;;;;;;IAAaA,IAAI,MAAJA;IACAC,QAAQ,MAARA;;AADN,MAAMD,OAAO,IAAME,QAAQC,OAAO;AAClC,MAAMF,WAAW,IAAM;AAC5B,QAAQ,GACV","_decoded":[[[0,0,0,0]],[],[],[],[],[],[],[],[],[],[],[[4,0,0,13,0],[8,0,0,17],[14,0,0,13,0]],[[4,0,1,13,1],[12,0,1,21],[18,0,1,13,1]],[],[[0,0,0,7],[6,0,0,13,0],[13,0,0,20],[17,0,0,26,2],[25,0,0,34,3],[32,0,0,41]],[[0,0,1,7],[6,0,1,13,1],[17,0,1,24],[21,0,1,30]],[[0,0,2,2],[8,0,2,10],[11,0,3,0]]],"_decodedMemo":{"lastKey":5,"lastNeedle":0,"lastIndex":-1}},"sourceTranspiled":{"lines":[{"line":1,"startCol":0,"endCol":13,"count":1,"ignore":false},{"line":2,"startCol":14,"endCol":60,"count":1,"ignore":false},{"line":3,"startCol":61,"endCol":76,"count":1,"ignore":false},{"line":4,"startCol":77,"endCol":80,"count":1,"ignore":false},{"line":5,"startCol":81,"endCol":112,"count":1,"ignore":false},{"line":6,"startCol":113,"endCol":174,"count":1,"ignore":false},{"line":7,"startCol":175,"endCol":200,"count":1,"ignore":false},{"line":8,"startCol":201,"endCol":223,"count":1,"ignore":false},{"line":9,"startCol":224,"endCol":231,"count":1,"ignore":false},{"line":10,"startCol":232,"endCol":233,"count":1,"ignore":false},{"line":11,"startCol":234,"endCol":252,"count":1,"ignore":false},{"line":12,"startCol":253,"endCol":272,"count":1,"ignore":false},{"line":13,"startCol":273,"endCol":299,"count":1,"ignore":false},{"line":14,"startCol":300,"endCol":303,"count":1,"ignore":false},{"line":15,"startCol":304,"endCol":339,"count":1,"ignore":false},{"line":16,"startCol":340,"endCol":362,"count":1,"ignore":false},{"line":17,"startCol":363,"endCol":376,"count":1,"ignore":false},{"line":18,"startCol":377,"endCol":377,"count":1,"ignore":false},{"line":19,"startCol":378,"endCol":944,"count":1,"ignore":false}],"eof":944,"shebangLength":0,"wrapperLength":77},"all":false} |
i've run into this too, i've pinned |
@jgeschwendt I tried about 500 different upgrades/resolutions within my package.json today with no luck until I stumbled upon this comment, so thank you 🥇 |
Ok, so the relevant call to That's a single line (0-based) matching line 13: This is a valid transform and sourcemap. So we hit I'm not sure why we're performing that second |
Not sure if this will help anyone, but I encountered the same issue, the file was exporting constants only: export const XXXXXXX = 'something'
export const YYYYYYY = 'something' After tracking down the issue, I figured out the solution, I just added one space above the very first // Constants
export const XXXXXXX = 'something'
export const YYYYYYY = 'something' I guessed it because in the file |
Hi, same issue experienced here. Independently to a proper and source based fix we have an easy patch applied at @jest/reporters/v8-to-istanbul@^9.0.1
That makes end not go beneath start position. |
I lowered @swc/jest to version 2.20 and it worked! |
Tried 0.2.20 and it doesn't work |
I have the same issue |
@hurstindustries curious why you closed your PR (apologies for the slow review 😄 , I'm guessing that might be the reasoning). I'll keep an eye out for a patch for this issue. |
Having an
🤷♂️ |
The simplest and safest way is to change the |
As @aladinflux and @mitestainer, adding a comment in line 1 of a file that was only exporting constants solved the issue (which was previously encountered in another project, and back then strangely resolved by lowering axios from 1.2.3 to 1.1.3). Quite curious as to why it happens. |
today's latest, doesn't work. |
Ran into this same issue, and pinning the For other folks' reference, I had to:
|
@brockross it much easier to use small patch - #198 (comment). no any issues in very large (8000+ tests) repo since nov'22 |
Hello, seems that the issue is still not fixed. As for me personally i wasnt able to find which test breaks the coverage collection process, so maybe really the easiest way is to add Edit: issue is caused by the first line export, so adding anything at the top of the file (for example comment) helps. |
I ran into this today as well and really appreciate all the suggestions here but have to many tests to go one by one. In order to find the file that had
|
Bro... thanks, I've hit the same error with |
Also running into this issue when running some tests using Jest. Tried pinning
|
I am getting
Cannot read properties of undefined (reading 'endCol')
when trying to generate coverage after ajest
test run when using@swc/jest
as a transformer.Error
Details
During this call:
v8-to-istanbul/lib/v8-to-istanbul.js
Line 205 in b5ecd82
It receives object with all properties
null
fromoriginalPositionFor
here:v8-to-istanbul/lib/source.js
Line 105 in b5ecd82
Which causes it to fail somewhere down the line.
Source File
Transformed File
If I transform it with
@swc
with source maps enabled, I get this:Source map
The text was updated successfully, but these errors were encountered: