Skip to content

Commit 7976e06

Browse files
codebytereloc
andcommitted
util: fix isInsideNodeModules() check
Co-authored-by: Andy Locascio <[email protected]>
1 parent c8df5cf commit 7976e06

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/internal/util.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const {
88
ERR_UNKNOWN_SIGNAL
99
},
1010
uvErrmapGet,
11-
overrideStackTrace,
1211
} = require('internal/errors');
1312
const { signals } = internalBinding('constants').os;
1413
const {
@@ -340,12 +339,12 @@ function isInsideNodeModules() {
340339
// the perf implications should be okay.
341340
getStructuredStack = runInNewContext(`(function() {
342341
Error.stackTraceLimit = Infinity;
342+
Error.prepareStackTrace = (err, trace) => trace;
343+
343344
return function structuredStack() {
344-
const e = new Error();
345-
overrideStackTrace.set(e, (err, trace) => trace);
346-
return e.stack;
345+
return new Error().stack;
347346
};
348-
})()`, { overrideStackTrace }, { filename: 'structured-stack' });
347+
})()`, {}, { filename: 'structured-stack' });
349348
}
350349

351350
const stack = getStructuredStack();

0 commit comments

Comments
 (0)