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

Try to load and parse the sourcemap before returning it #2355

Merged
merged 5 commits into from
Jan 28, 2022

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Jan 27, 2022

This should hopefully fix most of the cases where a source map that
is tried to be loaded but turns out to be gibberish doesn't stop the
whole execution of k6.

edit: this also fixes the error message about source map not being loaded, when goja also has other errors. Previous it would tell you stuff such as

WARN[0000] Couldn't load source map for file:///home/mstoykov/work/k6io/k6/l.js  error="file:///home/mstoykov/work/k6io/k6/l.js: Line 1:1 Unexpected reserved word (and 1 more errors)"

when for example the source map wasn't loaded properly but also babel needs to be invoked in order to transpile import/export for example.

This should hopefully fix most of the cases where a source map that
is tried to be loaded but turns out to be gibberish doesn't stop the
whole execution of k6.
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM, just one tiny thing

js/compiler/compiler_test.go Outdated Show resolved Hide resolved
js/compiler/compiler.go Outdated Show resolved Hide resolved
js/compiler/compiler.go Outdated Show resolved Hide resolved
Co-authored-by: na-- <n@andreev.sh>
@mstoykov mstoykov requested a review from na-- January 27, 2022 11:39
Copy link
Contributor

@codebien codebien left a comment

Choose a reason for hiding this comment

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

LGTM, remind to rebase or squash before merging

@mstoykov mstoykov merged commit 5099187 into master Jan 28, 2022
@mstoykov mstoykov deleted the sanityCheckSourceMapIfLoading branch January 28, 2022 10:24
@mstoykov mstoykov added this to the v0.37.0 milestone Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants