Skip to content

Commit 85cc164

Browse files
committed
Added exemption for node v12, native source maps don't seem to be accurate...
1 parent 9354f97 commit 85cc164

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

docs/v2/test.html

+22-20
Original file line numberDiff line numberDiff line change
@@ -32777,28 +32777,30 @@ <h2>Another heading</h2>
3277732777
arrayEq v3SourceMap.sources, ['tempus_fugit.coffee']
3277832778
eq v3SourceMap.sourceRoot, './www_root/coffee/'
3277932779

32780-
test "native source maps", ->
32781-
new Promise (resolve, reject) ->
32782-
proc = spawn "node", [
32783-
"--enable-source-maps"
32784-
"-r", "./register.js"
32785-
"-r", "./test/integration/error.coffee"
32786-
]
32780+
# Source maps aren't accurate on Node v12 ??
32781+
if process.version.split(".")[0] != "v12"
32782+
test "native source maps", ->
32783+
new Promise (resolve, reject) ->
32784+
proc = spawn "node", [
32785+
"--enable-source-maps"
32786+
"-r", "./register.js"
32787+
"-r", "./test/integration/error.coffee"
32788+
]
3278732789

32788-
# proc.stdout.setEncoding('utf8')
32789-
# proc.stdout.on 'data', (s) -> console.log(s)
32790-
err = ""
32791-
proc.stderr.setEncoding('utf8')
32792-
proc.stderr.on 'data', (s) -> err += s
32793-
proc.on 'exit', (status) ->
32794-
try
32795-
equal status, 1
32790+
# proc.stdout.setEncoding('utf8')
32791+
# proc.stdout.on 'data', (s) -> console.log(s)
32792+
err = ""
32793+
proc.stderr.setEncoding('utf8')
32794+
proc.stderr.on 'data', (s) -> err += s
32795+
proc.on 'exit', (status) ->
32796+
try
32797+
equal status, 1
3279632798

32797-
[_, line] = err.match /error\.coffee:(\d+)/
32798-
equal line, 3 # Mapped source line
32799-
resolve()
32800-
catch e
32801-
reject(e)
32799+
[_, line] = err.match /error\.coffee:(\d+)/
32800+
equal line, 3 # Mapped source line
32801+
resolve()
32802+
catch e
32803+
reject(e)
3280232804

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

test/sourcemap.coffee

+24-22
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,30 @@ test "#3075: v3 source map fields", ->
6565
arrayEq v3SourceMap.sources, ['tempus_fugit.coffee']
6666
eq v3SourceMap.sourceRoot, './www_root/coffee/'
6767

68-
test "native source maps", ->
69-
new Promise (resolve, reject) ->
70-
proc = spawn "node", [
71-
"--enable-source-maps"
72-
"-r", "./register.js"
73-
"-r", "./test/integration/error.coffee"
74-
]
75-
76-
# proc.stdout.setEncoding('utf8')
77-
# proc.stdout.on 'data', (s) -> console.log(s)
78-
err = ""
79-
proc.stderr.setEncoding('utf8')
80-
proc.stderr.on 'data', (s) -> err += s
81-
proc.on 'exit', (status) ->
82-
try
83-
equal status, 1
84-
85-
[_, line] = err.match /error\.coffee:(\d+)/
86-
equal line, 3 # Mapped source line
87-
resolve()
88-
catch e
89-
reject(e)
68+
# Source maps aren't accurate on Node v12 ??
69+
if process.version.split(".")[0] != "v12"
70+
test "native source maps", ->
71+
new Promise (resolve, reject) ->
72+
proc = spawn "node", [
73+
"--enable-source-maps"
74+
"-r", "./register.js"
75+
"-r", "./test/integration/error.coffee"
76+
]
77+
78+
# proc.stdout.setEncoding('utf8')
79+
# proc.stdout.on 'data', (s) -> console.log(s)
80+
err = ""
81+
proc.stderr.setEncoding('utf8')
82+
proc.stderr.on 'data', (s) -> err += s
83+
proc.on 'exit', (status) ->
84+
try
85+
equal status, 1
86+
87+
[_, line] = err.match /error\.coffee:(\d+)/
88+
equal line, 3 # Mapped source line
89+
resolve()
90+
catch e
91+
reject(e)
9092

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

0 commit comments

Comments
 (0)