Skip to content

Commit

Permalink
Added source map support
Browse files Browse the repository at this point in the history
Close #330
Close #329
  • Loading branch information
bpmccurdy authored and isaacs committed Feb 7, 2017
1 parent f3f0a6b commit 3d89b54
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/stack.js
@@ -1,3 +1,4 @@
var sourceMapSupport = require('source-map-support')
var StackUtils = require('stack-utils')
var path = require('path')
var tapDir = path.resolve(__dirname, '..')
Expand All @@ -14,10 +15,12 @@ var skip = process.cwd() !== tapDir ||
]
: []

sourceMapSupport.install({environment:'node'})
// Ignore tap if it's a dependency, or anything
// in this lib folder.
module.exports = new StackUtils({
internals: StackUtils.nodeInternals().concat(skip)
internals: StackUtils.nodeInternals().concat(skip),
wrapCallSite: sourceMapSupport.wrapCallSite
})

function resc(str) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -32,6 +32,7 @@
"own-or-env": "^1.0.0",
"readable-stream": "^2.0.2",
"signal-exit": "^3.0.0",
"source-map-support": "^0.4.3",
"stack-utils": "^1.0.0",
"tap-mocha-reporter": "^3.0.1",
"tap-parser": "^5.3.1",
Expand Down
15 changes: 15 additions & 0 deletions test/test/source-map-fail--bail--buffer.tap
@@ -0,0 +1,15 @@
TAP version 13
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~ {
1..1
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~ {
1..1
not ok 1 - fail
---
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
...

Bail out! # fail
}
}
Bail out! # fail

13 changes: 13 additions & 0 deletions test/test/source-map-fail--bail.tap
@@ -0,0 +1,13 @@
TAP version 13
# Subtest: gp
1..1
# Subtest: parent
1..1
not ok 1 - fail
---
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
...

Bail out! # fail
Bail out! # fail

20 changes: 20 additions & 0 deletions test/test/source-map-fail--buffer.tap
@@ -0,0 +1,20 @@
TAP version 13
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~ {
1..1
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~ {
1..1
not ok 1 - fail
---
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
...

# failed 1 test
}

# failed 1 test
}

1..1
# failed 1 test
___/# time=[0-9.]+(ms)?/~~~

12 changes: 12 additions & 0 deletions test/test/source-map-fail-bail.tap
@@ -0,0 +1,12 @@
TAP version 13
# Subtest: gp
1..1
# Subtest: parent
1..1
not ok 1 - fail
---
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
...
Bail out! # fail
Bail out! # fail

7 changes: 7 additions & 0 deletions test/test/source-map-fail.coffee
@@ -0,0 +1,7 @@
t = require '../..'

t.test 'gp', (t) ->
t.plan 1
t.test 'parent', (t) ->
t.plan 1
t.fail 'fail'
17 changes: 17 additions & 0 deletions test/test/source-map-fail.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions test/test/source-map-fail.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions test/test/source-map-fail.tap
@@ -0,0 +1,20 @@
TAP version 13
# Subtest: gp
1..1
# Subtest: parent
1..1
not ok 1 - fail
---
{"at":{"column":7,"file":"test/test/source-map-fail.coffee","line":7},"source":"t.fail 'fail'\n"}
...

# failed 1 test
not ok 1 - parent ___/# time=[0-9.]+(ms)?/~~~

# failed 1 test
not ok 1 - gp ___/# time=[0-9.]+(ms)?/~~~

1..1
# failed 1 test
___/# time=[0-9.]+(ms)?/~~~

0 comments on commit 3d89b54

Please sign in to comment.