Skip to content
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

Merged
merged 8 commits into from
Oct 6, 2020

Conversation

connorjclark
Copy link
Collaborator

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 the valid-sourcemaps audit from the warning.

@connorjclark connorjclark requested a review from a team as a code owner March 10, 2020 21:11
@connorjclark connorjclark requested review from brendankenny and removed request for a team March 10, 2020 21:11
types/artifacts.d.ts Outdated Show resolved Hide resolved
Copy link
Member

@brendankenny brendankenny left a 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};
Copy link
Member

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 :)

Copy link
Member

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

Copy link
Collaborator Author

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)

types/artifacts.d.ts Outdated Show resolved Hide resolved
types/artifacts.d.ts Outdated Show resolved Hide resolved
types/artifacts.d.ts Outdated Show resolved Hide resolved
lighthouse-core/test/computed/js-bundles-test.js Outdated Show resolved Hide resolved
return failureResult;
const error = `${map.url()} mapping for line out of bounds: ${lineNum + 1}`;
log.error('JSBundles', error);
return {error};
Copy link
Member

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>
Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants