Skip to content

Commit 3d89b54

Browse files
bpmccurdyisaacs
authored andcommitted
Added source map support
Close #330 Close #329
1 parent f3f0a6b commit 3d89b54

10 files changed

+119
-1
lines changed

lib/stack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var sourceMapSupport = require('source-map-support')
12
var StackUtils = require('stack-utils')
23
var path = require('path')
34
var tapDir = path.resolve(__dirname, '..')
@@ -14,10 +15,12 @@ var skip = process.cwd() !== tapDir ||
1415
]
1516
: []
1617

18+
sourceMapSupport.install({environment:'node'})
1719
// Ignore tap if it's a dependency, or anything
1820
// in this lib folder.
1921
module.exports = new StackUtils({
20-
internals: StackUtils.nodeInternals().concat(skip)
22+
internals: StackUtils.nodeInternals().concat(skip),
23+
wrapCallSite: sourceMapSupport.wrapCallSite
2124
})
2225

2326
function resc(str) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"own-or-env": "^1.0.0",
3333
"readable-stream": "^2.0.2",
3434
"signal-exit": "^3.0.0",
35+
"source-map-support": "^0.4.3",
3536
"stack-utils": "^1.0.0",
3637
"tap-mocha-reporter": "^3.0.1",
3738
"tap-parser": "^5.3.1",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TAP version 13
2+
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~ {
3+
1..1
4+
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~ {
5+
1..1
6+
not ok 1 - fail
7+
---
8+
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
9+
...
10+
11+
Bail out! # fail
12+
}
13+
}
14+
Bail out! # fail
15+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
TAP version 13
2+
# Subtest: gp
3+
1..1
4+
# Subtest: parent
5+
1..1
6+
not ok 1 - fail
7+
---
8+
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
9+
...
10+
11+
Bail out! # fail
12+
Bail out! # fail
13+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
TAP version 13
2+
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~ {
3+
1..1
4+
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~ {
5+
1..1
6+
not ok 1 - fail
7+
---
8+
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
9+
...
10+
11+
# failed 1 test
12+
}
13+
14+
# failed 1 test
15+
}
16+
17+
1..1
18+
# failed 1 test
19+
___/# time=[0-9.]+(ms)?/~~~
20+

test/test/source-map-fail-bail.tap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
TAP version 13
2+
# Subtest: gp
3+
1..1
4+
# Subtest: parent
5+
1..1
6+
not ok 1 - fail
7+
---
8+
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
9+
...
10+
Bail out! # fail
11+
Bail out! # fail
12+

test/test/source-map-fail.coffee

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
t = require '../..'
2+
3+
t.test 'gp', (t) ->
4+
t.plan 1
5+
t.test 'parent', (t) ->
6+
t.plan 1
7+
t.fail 'fail'

test/test/source-map-fail.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test/source-map-fail.js.map

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test/source-map-fail.tap

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
TAP version 13
2+
# Subtest: gp
3+
1..1
4+
# Subtest: parent
5+
1..1
6+
not ok 1 - fail
7+
---
8+
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
9+
...
10+
11+
# failed 1 test
12+
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~
13+
14+
# failed 1 test
15+
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~
16+
17+
1..1
18+
# failed 1 test
19+
___/# time=[0-9.]+(ms)?/~~~
20+

0 commit comments

Comments
 (0)