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

fix(sourcemaps): missing sourcemaps on debugger statement #503

Merged
merged 3 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/astring.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ export const GENERATOR = {
}),
ForOfStatement: ForInStatement,
DebuggerStatement(node, state) {
state.write('debugger;' + state.lineEnd)
state.write('debugger;', node)
},
FunctionDeclaration: (FunctionDeclaration = function (node, state) {
state.write(
Expand Down
4 changes: 4 additions & 0 deletions src/tests/astring.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ test('Source map generation', (assert) => {
generate(ast, {
sourceMap,
})
assert.true(
sourceMap.mappings.length > 0,
`Expect ${path.basename(filename)} to have mappings`,
)
})
})

Expand Down
4 changes: 0 additions & 4 deletions src/tests/fixtures/sourcemap-cases/strings.js

This file was deleted.

2 changes: 2 additions & 0 deletions src/tests/fixtures/syntax/debugger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
debugger;
"this string should be mapped to the second line";