Skip to content

Commit

Permalink
Filter out internals which have no function names (tapjs#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell authored Apr 27, 2020
1 parent d3c7ee2 commit 3907a9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ const natives = [].concat(
require('module').builtinModules,
'bootstrap_node',
'node',
'internal/bootstrap/node'
).map(n => new RegExp(`\\(${n}\\.js:\\d+:\\d+\\)$`));
).map(n => new RegExp(`(?:\\(${n}\\.js:\\d+:\\d+\\)$|^\\s*at ${n}\\.js:\\d+:\\d+$)`));

natives.push(
// XXX are `bootstrap_node.js` and `node.js` needed in supported versions?
/\s*at (bootstrap_)?node\.js:\d+:\d+?$/,
/\(internal\/[^:]+:\d+:\d+\)$/,
/\s*at internal[/]main[/]run_main_module\.js:\d+:\d+$/,
/\s*at internal\/[^:]+:\d+:\d+$/,
/\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/
);

Expand Down
3 changes: 2 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ t.test('clean: truncates cwd', t => {
'Module.load (module.js:344:32)',
'Function.Module._load (module.js:301:12)',
'Function.Module.runMain (module.js:430:10)',
'module.js:430:10',
'run (bootstrap_node.js:420:7)',
'startup (bootstrap_node.js:139:9)',
'bootstrap_node.js:535:3',
Expand Down Expand Up @@ -403,6 +404,7 @@ function internalStack() {
' at Module.load (module.js:344:32)',
' at Function.Module._load (module.js:301:12)',
' at Function.Module.runMain (module.js:430:10)',
' at module.js:430:10',
' at run (bootstrap_node.js:420:7)',
' at startup (bootstrap_node.js:139:9)',
' at bootstrap_node.js:535:3',
Expand All @@ -412,7 +414,6 @@ function internalStack() {

function internals() {
return StackUtils.nodeInternals().concat([
/internal\/main\/run_main_module\.js/,
/test\.js:\d+:\d+\)?$/,
/\/node_modules\//
]);
Expand Down

0 comments on commit 3907a9a

Please sign in to comment.