-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test_runner: throw on invalid source map #55055
test_runner: throw on invalid source map #55055
Conversation
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #55055 +/- ##
==========================================
- Coverage 88.41% 88.41% -0.01%
==========================================
Files 652 652
Lines 186576 186579 +3
Branches 36049 36049
==========================================
- Hits 164960 164955 -5
- Misses 14889 14900 +11
+ Partials 6727 6724 -3
|
095e3e3
to
a916ce4
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
a916ce4
to
51f959c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please stop changing unrelated things in PRs. It makes PRs more difficult to review and is more likely to introduce issues. If you feel strongly that the source map fixtures should be renamed, please do that in a separate PR.
]; | ||
|
||
describe('Coverage with source maps', async () => { | ||
await it('should work with source maps', async (t) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need the await
s on the tests.
lib/internal/test_runner/coverage.js
Outdated
@@ -353,6 +354,7 @@ class TestCoverage { | |||
continue; | |||
} | |||
const { data, lineLengths } = sourceMapCache[url]; | |||
if (!data) throw new ERR_SOURCE_MAP_CANNOT_PARSE(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit torn on this error for a couple of reasons:
- The error says that the source map does not exist or cannot be parsed... but there is still an entry for it in the source map cache.
- The fact that this error is about source maps, but it is only thrown from the test runner even though there is other source map functionality in core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error says that the source map does not exist or cannot be parsed... but there is still an entry for it in the source map cache.
There is an entry, but it's empty.
Before this change, an error was thrown because the entry was empty, and therefore didn't have any properties. Does that error get thrown anywhere else? If so, I can try and handle them as well
IMO it's related because this adds tests, and moving them into their own file is good for decluttering, but I'll move it feel it's unrelated. |
7aad9a2
to
1e8287f
Compare
97d87a6
to
87af23b
Compare
Landed in 9a9409f |
PR-URL: #55055 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs#55055 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs#55055 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
This PR changes the code coverage test runner to throw
ERR_SOURCE_MAP_CORRUPT
when a sourcemap is not a valid JSON file, or does not exist.