-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(js-bundles): return error object when sizes cannot be determined #10449
Conversation
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.
@connorjclark do you still want this change? It reads reasonably to me all these months later, so I'm going to assume yes :)
edit: oh, yeah, you updated the branch, so definitely yes :)
return failureResult; | ||
const error = `${map.url()} mapping for line out of bounds: ${lineNum + 1}`; | ||
log.error('JSBundles', error); | ||
return {error}; |
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.
good point, codecov, should have a test for this case :)
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.
missing coverage is for the "line out of bounds" case
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.
ah, I meant to get that w/ d517ec5 , but I tested the wrong thing (column OOB instead of line OOB)
return failureResult; | ||
const error = `${map.url()} mapping for line out of bounds: ${lineNum + 1}`; | ||
log.error('JSBundles', error); | ||
return {error}; |
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.
missing coverage is for the "line out of bounds" case
Co-authored-by: Brendan Kenny <bckenny@gmail.com>
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
This change forces consumers of JSBundles to explicitly check for errors before using
.sizes
, instead of relying on a no-op behavior by returning an empty result.We could emit a warning when an audit encounters this, but I'm not certain we should. The
valid-sourcemaps
audit will certainly make this error visible. If other audits emit a warning I would want a way to link to thevalid-sourcemaps
audit from the warning.