618ba5e2ffc69d88e8160f22b98c470fc04e0c8d.svn-base
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict'
const sourceMapSupport = require('source-map-support')
const StackUtils = require('stack-utils')
const path = require('path')
const tapDir = path.resolve(__dirname, '..')
const {homedir} = require('os')
const resc = str =>
str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
// Ignore tap if it's a dependency, or anything
// in this lib folder.
// don't skip when developing on tap itself
const skip = (process.cwd() !== tapDir ||
+process.env.TAP_DEV_SHORTSTACK === 1) &&
+process.env.TAP_DEV_LONGSTACK !== 1
? [
/node_modules[\/\\]tap[\/\\]/,
/at internal\/.*\.js:\d+:\d+/m,
new RegExp(resc(path.resolve(homedir(), '.node-spawn-wrap-')) + '.*'),
new RegExp(resc(tapDir) + '\\b', 'i'),
new RegExp('at ' + resc('Generator.next (<anonymous>)'), 'i'),
].concat(/* istanbul ignore next */ require.resolve
? [
new RegExp(resc(require.resolve('function-loop'))),
new RegExp(resc(require.resolve('esm'))),
new RegExp(resc(require.resolve('nyc').replace(/(node_modules[\/\\]nyc).*$/, '$1'))),
new RegExp(resc(require.resolve('import-jsx'))),
]
: [])
: +process.env.TAP_DEV_LONGSTACK !== 1 ? [
/at internal\/.*\.js:\d+:\d+/m,
new RegExp(resc(require.resolve('esm'))),
new RegExp(resc(require.resolve('nyc').replace(/(node_modules[\/\\]nyc).*$/, '$1'))),
new RegExp(resc(require.resolve('import-jsx'))),
]
: []
sourceMapSupport.install({environment:'node', hookRequire: true})
let nodeInternals = []
try {
nodeInternals = StackUtils.nodeInternals()
} catch (error) {
// Do nothing.
}
module.exports = new StackUtils({
internals: nodeInternals.concat(skip),
wrapCallSite: sourceMapSupport.wrapCallSite
})