Skip to content

Commit fe92db3

Browse files
committed
Add a more complete list of Nodes internal files to nodeInternals()
Also swaps `[0-9]` for `\d` everywhere. Fixes #8.
1 parent df98523 commit fe92db3

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

index.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ function StackUtils(opts) {
1212
module.exports.nodeInternals = nodeInternals;
1313

1414
function nodeInternals() {
15-
// This was tap specific
16-
// /node_modules[\\\/]tap[\\\/](.*?)\.js:[0-9]:[0-9]\)?$/
1715
return [
18-
/\(domain.js:[0-9]+:[0-9]+\)$/,
19-
/\(events.js:[0-9]+:[0-9]+\)$/,
20-
/\(node.js:[0-9]+:[0-9]+\)$/,
21-
/\(timers.js:[0-9]+:[0-9]+\)$/,
22-
/\(module.js:[0-9]+:[0-9]+\)$/,
23-
/GeneratorFunctionPrototype.next \(native\)/
16+
/\(native\)$/,
17+
/\(domain.js:\d+:\d+\)$/,
18+
/\(events.js:\d+:\d+\)$/,
19+
/\(node.js:\d+:\d+\)$/,
20+
/\(timers.js:\d+:\d+\)$/,
21+
/\(module.js:\d+:\d+\)$/,
22+
/\(internal\/[\w_-]+\.js:\d+:\d+\)$/,
23+
/\s*at node\.js:\d+:\d+?$/,
24+
/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/
2425
];
2526
}
2627

@@ -211,11 +212,11 @@ var re = new RegExp(
211212
// (eval at <anonymous> (file.js:1:1),
212213
// $4 = eval origin
213214
// $5:$6:$7 are eval file/line/col, but not normally reported
214-
'(?:eval at ([^ ]+) \\(([^\\)]+):([0-9]+):([0-9]+)\\), )?' +
215+
'(?:eval at ([^ ]+) \\(([^\\)]+):(\\d+):(\\d+)\\), )?' +
215216
// file:line:col
216217
// $8:$9:$10
217218
// $11 = 'native' if native
218-
'(?:([^\\)]+):([0-9]+):([0-9]+)|(native))' +
219+
'(?:([^\\)]+):(\\d+):(\\d+)|(native))' +
219220
// maybe close the paren, then end
220221
'\\)?$'
221222
);

test/long-stack-traces.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ import {join, fixtureDir} from './_utils';
88

99
function internals() {
1010
return StackUtils.nodeInternals().concat([
11-
/\/long-stack-traces\.js:[0-9]+:[0-9]+\)?$/,
12-
/\/internal-error\.js:[0-9]+:[0-9]+\)?$/,
13-
/\/internal-then\.js:[0-9]+:[0-9]+\)?$/,
14-
/\/node_modules\//,
15-
// TODO: Should any of these be default internals?
16-
/\/\.node-spawn-wrap-\w+-\w+\/node:[0-9]+:[0-9]+\)?$/,
17-
/internal\/module\.js:[0-9]+:[0-9]+\)?$/,
18-
/node\.js:[0-9]+:[0-9]+\)?$/
11+
/\/long-stack-traces\.js:\d+:\d+\)?$/,
12+
/\/internal-error\.js:\d+:\d+\)?$/,
13+
/\/internal-then\.js:\d+:\d+\)?$/,
14+
/\/node_modules\//
1915
]);
2016
}
2117

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ function internalStack() {
326326

327327
function internals() {
328328
return StackUtils.nodeInternals().concat([
329-
/test\.js:[0-9]+:[0-9]+\)?$/,
329+
/test\.js:\d+:\d+\)?$/,
330330
/\/node_modules\//
331331
]);
332332
}

0 commit comments

Comments
 (0)