Skip to content

Commit

Permalink
Added exemption for node v12, native source maps don't seem to be acc…
Browse files Browse the repository at this point in the history
…urate...
  • Loading branch information
STRd6 committed Apr 3, 2022
1 parent 9354f97 commit 50dfa8e
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions test/sourcemap.coffee
Expand Up @@ -65,28 +65,30 @@ test "#3075: v3 source map fields", ->
arrayEq v3SourceMap.sources, ['tempus_fugit.coffee']
eq v3SourceMap.sourceRoot, './www_root/coffee/'

test "native source maps", ->
new Promise (resolve, reject) ->
proc = spawn "node", [
"--enable-source-maps"
"-r", "./register.js"
"-r", "./test/integration/error.coffee"
]

# proc.stdout.setEncoding('utf8')
# proc.stdout.on 'data', (s) -> console.log(s)
err = ""
proc.stderr.setEncoding('utf8')
proc.stderr.on 'data', (s) -> err += s
proc.on 'exit', (status) ->
try
equal status, 1

[_, line] = err.match /error\.coffee:(\d+)/
equal line, 3 # Mapped source line
resolve()
catch e
reject(e)
# Source maps aren't accurate on Node v12 ??
if process.version.split(".")[0] != "v12"
test "native source maps", ->
new Promise (resolve, reject) ->
proc = spawn "node", [
"--enable-source-maps"
"-r", "./register.js"
"-r", "./test/integration/error.coffee"
]

# proc.stdout.setEncoding('utf8')
# proc.stdout.on 'data', (s) -> console.log(s)
err = ""
proc.stderr.setEncoding('utf8')
proc.stderr.on 'data', (s) -> err += s
proc.on 'exit', (status) ->
try
equal status, 1

[_, line] = err.match /error\.coffee:(\d+)/
equal line, 3 # Mapped source line
resolve()
catch e
reject(e)

test "don't change stack traces if another library has patched `Error.prepareStackTrace`", ->
new Promise (resolve, reject) ->
Expand Down

0 comments on commit 50dfa8e

Please sign in to comment.