Skip to content

Commit

Permalink
fix(sourcemaps): missing sourcemaps on debugger statement (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonnet authored Apr 5, 2021
1 parent d3e22f9 commit 9822a2a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
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";

0 comments on commit 9822a2a

Please sign in to comment.