mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: remove cjs loader from stack traces
PR-URL: https://github.com/nodejs/node/pull/44197 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 3;
|
||||
|
||||
const punycode = require('punycode');
|
||||
|
||||
// This test verifies that line numbers in core modules are reported correctly.
|
||||
|
||||
@@ -6,11 +6,5 @@ RangeError: Invalid input
|
||||
at error (node:punycode:52:8)
|
||||
at Object.decode (node:punycode:*:*)
|
||||
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
const { aggregateTwoErrors } = require('internal/errors');
|
||||
|
||||
const originalError = new Error('original');
|
||||
|
||||
@@ -1,34 +1,15 @@
|
||||
*error_aggregateTwoErrors.js:*
|
||||
throw aggregateTwoErrors(err, originalError);
|
||||
^
|
||||
AggregateError: original
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
[AggregateError: original] {
|
||||
code: 'ERR0',
|
||||
[errors]: [
|
||||
Error: original
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*) {
|
||||
code: 'ERR0'
|
||||
},
|
||||
Error: second error
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*) {
|
||||
code: 'ERR1'
|
||||
}
|
||||
]
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
process.on('exit', function(code) {
|
||||
|
||||
@@ -7,13 +7,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
|
||||
|
||||
1 !== 2
|
||||
|
||||
at Object.<anonymous> (*test*message*error_exit.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
at Object.<anonymous> (*test*message*error_exit.js:*:*) {
|
||||
generatedMessage: true,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: 1,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
function test() {
|
||||
const a = 'abc\0def';
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
|
||||
function foo() {
|
||||
|
||||
@@ -5,18 +5,8 @@ node:events:*
|
||||
Error: foo:bar
|
||||
at bar (*events_unhandled_error_common_trace.js:*:*)
|
||||
at foo (*events_unhandled_error_common_trace.js:*:*)
|
||||
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
Emitted 'error' event at:
|
||||
at quux (*events_unhandled_error_common_trace.js:*:*)
|
||||
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
[... lines matching original stack trace ...]
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const er = new Error();
|
||||
process.nextTick(() => {
|
||||
|
||||
@@ -4,14 +4,7 @@ node:events:*
|
||||
|
||||
Error
|
||||
at Object.<anonymous> (*events_unhandled_error_nexttick.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
Emitted 'error' event at:
|
||||
at *events_unhandled_error_nexttick.js:*:*
|
||||
at process.processTicksAndRejections (node:internal/process/task_queues:*:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
new EventEmitter().emit('error', new Error());
|
||||
|
||||
@@ -4,16 +4,7 @@ node:events:*
|
||||
|
||||
Error
|
||||
at Object.<anonymous> (*events_unhandled_error_sameline.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
Emitted 'error' event at:
|
||||
at Object.<anonymous> (*events_unhandled_error_sameline.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
[... lines matching original stack trace ...]
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
class Foo extends EventEmitter {}
|
||||
new Foo().emit('error', new Error());
|
||||
|
||||
@@ -4,16 +4,7 @@ node:events:*
|
||||
|
||||
Error
|
||||
at Object.<anonymous> (*events_unhandled_error_subclass.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
Emitted 'error' event on Foo instance at:
|
||||
at Object.<anonymous> (*events_unhandled_error_subclass.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
[... lines matching original stack trace ...]
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 4;
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
let err;
|
||||
|
||||
@@ -10,26 +10,14 @@ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
|
||||
at c (*if-error-has-good-stack.js:*:*)
|
||||
at b (*if-error-has-good-stack.js:*:*)
|
||||
at a (*if-error-has-good-stack.js:*:*)
|
||||
at Object.<anonymous> (*if-error-has-good-stack.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
at Object.<anonymous> (*if-error-has-good-stack.js:*:*) {
|
||||
generatedMessage: false,
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: Error: test error
|
||||
at c (*if-error-has-good-stack.js:*:*)
|
||||
at b (*if-error-has-good-stack.js:*:*)
|
||||
at a (*if-error-has-good-stack.js:*:*)
|
||||
at Object.<anonymous> (*if-error-has-good-stack.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
at Object.<anonymous> (*if-error-has-good-stack.js:*:*),
|
||||
expected: null,
|
||||
operator: 'ifError'
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 5;
|
||||
|
||||
process.setSourceMapsEnabled(false);
|
||||
|
||||
|
||||
@@ -4,19 +4,9 @@ Error: an error!
|
||||
at functionB (*enclosing-call-site-min.js:1:60)
|
||||
at functionA (*enclosing-call-site-min.js:1:26)
|
||||
at Object.<anonymous> (*enclosing-call-site-min.js:1:199)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
Error: an error!
|
||||
at functionD (*enclosing-call-site.js:16:17)
|
||||
at functionC (*enclosing-call-site.js:10:3)
|
||||
at functionB (*enclosing-call-site.js:6:3)
|
||||
at functionA (*enclosing-call-site.js:2:3)
|
||||
at Object.<anonymous> (*enclosing-call-site.js:24:3)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 5;
|
||||
|
||||
process.setSourceMapsEnabled(true);
|
||||
|
||||
|
||||
@@ -4,19 +4,9 @@ Error: an error!
|
||||
at functionB (*enclosing-call-site.js:6:3)
|
||||
at functionA (*enclosing-call-site.js:2:3)
|
||||
at Object.<anonymous> (*enclosing-call-site.js:24:3)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
Error: an error!
|
||||
at functionD (*enclosing-call-site-min.js:1:156)
|
||||
at functionC (*enclosing-call-site-min.js:1:97)
|
||||
at functionB (*enclosing-call-site-min.js:1:60)
|
||||
at functionA (*enclosing-call-site-min.js:1:26)
|
||||
at Object.<anonymous> (*enclosing-call-site-min.js:1:199)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 5;
|
||||
|
||||
require('../fixtures/source-map/enclosing-call-site-min.js');
|
||||
|
||||
@@ -8,10 +8,5 @@ Error: an error!
|
||||
at functionB (*enclosing-call-site.js:6:3)
|
||||
at functionA (*enclosing-call-site.js:2:3)
|
||||
at Object.<anonymous> (*enclosing-call-site.js:24:3)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 3;
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const content = fs.readFileSync(require.resolve('../fixtures/source-map/tabs.js'), 'utf8');
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
ReferenceError: alert is not defined
|
||||
at Object.eval (*tabs.coffee:26:2)
|
||||
at eval (*tabs.coffee:1:14)
|
||||
at Object.<anonymous> (*source_map_eval.js:8:1)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*
|
||||
at Object.<anonymous> (*source_map_eval.js:*:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
require('../fixtures/source-map/no-source.js');
|
||||
|
||||
@@ -5,13 +5,5 @@
|
||||
Error: foo
|
||||
at Throw (*file-not-exists.ts:2:9)
|
||||
at Object.<anonymous> (*file-not-exists.ts:5:1)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
at require (node:internal/modules/cjs/helpers:*)
|
||||
at Object.<anonymous> (*source_map_no_source_file.js:6:1)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
require('../fixtures/source-map/tabs.js');
|
||||
|
||||
@@ -5,13 +5,5 @@
|
||||
ReferenceError: alert is not defined
|
||||
at *tabs.coffee:26:2*
|
||||
at *tabs.coffee:1:14*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*
|
||||
at Module.load (node:internal/modules/cjs/loader:*
|
||||
at Module._load (node:internal/modules/cjs/loader:*
|
||||
at Module.require (node:internal/modules/cjs/loader:*
|
||||
at require (node:internal/modules/cjs/helpers:*
|
||||
at Object.<anonymous> (*source_map_reference_error_tabs.js:*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
try {
|
||||
require('../fixtures/source-map/typescript-throw');
|
||||
} catch (err) {
|
||||
|
||||
@@ -2,11 +2,3 @@ reachable
|
||||
Error: an exception
|
||||
at *typescript-throw.ts:18:11*
|
||||
at *typescript-throw.ts:24:1*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
at require (node:internal/modules/cjs/helpers:*)
|
||||
at Object.<anonymous> (*source_map_throw_catch.js:6:3)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
require('../fixtures/source-map/typescript-throw');
|
||||
|
||||
@@ -5,13 +5,5 @@ reachable
|
||||
Error: an exception
|
||||
at *typescript-throw.ts:18:11*
|
||||
at *typescript-throw.ts:24:1*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Module.require (node:internal/modules/cjs/loader:*)
|
||||
at require (node:internal/modules/cjs/helpers:*)
|
||||
at Object.<anonymous> (*source_map_throw_first_tick.js:5:1)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 2;
|
||||
|
||||
require('../fixtures/source-map/icu');
|
||||
|
||||
@@ -5,13 +5,5 @@
|
||||
Error: an error
|
||||
at *icu.jsx:3:23*
|
||||
at *icu.jsx:9:5*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*
|
||||
at Module.load (node:internal/modules/cjs/loader:*
|
||||
at Module._load (node:internal/modules/cjs/loader:*
|
||||
at Module.require (node:internal/modules/cjs/loader:*
|
||||
at require (node:internal/modules/cjs/helpers:*
|
||||
at Object.<anonymous> (*source_map_throw_icu.js:*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 1;
|
||||
|
||||
throw new Error('foo');
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
*:6
|
||||
*:7
|
||||
throw new Error('foo');
|
||||
^
|
||||
|
||||
Error: foo
|
||||
at Object.<anonymous> (*:6:7)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
at Object.<anonymous> (*:7:7)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Flags: --trace-uncaught
|
||||
'use strict';
|
||||
require('../common');
|
||||
throw { // eslint-disable-line no-throw-literal
|
||||
get stack() {
|
||||
throw new Error('weird throw but ok');
|
||||
},
|
||||
get name() {
|
||||
throw new Error('weird throw but ok');
|
||||
},
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
*:4
|
||||
throw { // eslint-disable-line no-throw-literal
|
||||
^
|
||||
[object Object]
|
||||
Thrown at:
|
||||
at *throw_error_with_getter_throw_traced.js:*:*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at executeUserEntryPoint (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
@@ -1,6 +0,0 @@
|
||||
// Flags: --trace-uncaught
|
||||
'use strict';
|
||||
require('../common');
|
||||
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
throw null;
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
*test*message*throw_null_traced.js:*
|
||||
throw null;
|
||||
^
|
||||
null
|
||||
Thrown at:
|
||||
at *throw_null_traced.js:*:*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at executeUserEntryPoint (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
@@ -1,6 +0,0 @@
|
||||
// Flags: --trace-uncaught
|
||||
'use strict';
|
||||
require('../common');
|
||||
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
throw undefined;
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
*test*message*throw_undefined_traced.js:*
|
||||
throw undefined;
|
||||
^
|
||||
undefined
|
||||
Thrown at:
|
||||
at *throw_undefined_traced.js:*:*
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at executeUserEntryPoint (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
@@ -26,6 +26,6 @@ const vm = require('vm');
|
||||
console.error('before');
|
||||
|
||||
// undefined reference
|
||||
vm.runInNewContext('foo.bar = 5;');
|
||||
vm.runInNewContext('Error.stackTraceLimit = 5; foo.bar = 5;');
|
||||
|
||||
console.error('after');
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
before
|
||||
evalmachine.<anonymous>:1
|
||||
foo.bar = 5;
|
||||
^
|
||||
Error.stackTraceLimit = 5; foo.bar = 5;
|
||||
^
|
||||
|
||||
ReferenceError: foo is not defined
|
||||
at evalmachine.<anonymous>:1:1
|
||||
at evalmachine.<anonymous>:*:*
|
||||
at Script.runInContext (node:vm:*)
|
||||
at Script.runInNewContext (node:vm:*)
|
||||
at Object.runInNewContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*undefined_reference_in_new_context.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at *..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 4;
|
||||
|
||||
const vm = require('vm');
|
||||
|
||||
console.error('beginning');
|
||||
|
||||
@@ -8,12 +8,6 @@ Error: boo!
|
||||
at Script.runInThisContext (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_display_runtime_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
test.vm:1
|
||||
throw new Error("spooky!")
|
||||
^
|
||||
@@ -23,11 +17,5 @@ Error: spooky!
|
||||
at Script.runInThisContext (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_display_runtime_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 4;
|
||||
|
||||
const vm = require('vm');
|
||||
|
||||
console.error('beginning');
|
||||
|
||||
@@ -7,12 +7,6 @@ SyntaxError: Unexpected number
|
||||
at createScript (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_display_syntax_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
test.vm:1
|
||||
var 5;
|
||||
^
|
||||
@@ -21,11 +15,5 @@ SyntaxError: Unexpected number
|
||||
at createScript (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_display_syntax_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 4;
|
||||
|
||||
const vm = require('vm');
|
||||
|
||||
console.error('beginning');
|
||||
|
||||
@@ -9,11 +9,5 @@ Error: boo!
|
||||
at Script.runInThisContext (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_dont_display_runtime_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
Error.stackTraceLimit = 4;
|
||||
|
||||
const vm = require('vm');
|
||||
|
||||
console.error('beginning');
|
||||
|
||||
@@ -9,11 +9,5 @@ SyntaxError: Unexpected number
|
||||
at createScript (node:vm:*)
|
||||
at Object.runInThisContext (node:vm:*)
|
||||
at Object.<anonymous> (*test*message*vm_dont_display_syntax_error.js:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*)
|
||||
at node:internal/main/run_main_module:*:*
|
||||
|
||||
Node.js *
|
||||
|
||||
27
test/parallel/test-throw-error-with-getter-throw-traced.mjs
Normal file
27
test/parallel/test-throw-error-with-getter-throw-traced.mjs
Normal file
@@ -0,0 +1,27 @@
|
||||
import { spawnPromisified } from '../common/index.mjs';
|
||||
import assert from 'node:assert';
|
||||
import { execPath } from 'node:process';
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
|
||||
describe('--trace-uncaught', () => {
|
||||
it('prints a trace on process exit for uncaught errors', async () => {
|
||||
const { code, signal, stderr } = await spawnPromisified(execPath, [
|
||||
'--trace-uncaught',
|
||||
'--eval',
|
||||
`throw {
|
||||
get stack() {
|
||||
throw new Error('weird throw but ok');
|
||||
},
|
||||
get name() {
|
||||
throw new Error('weird throw but ok');
|
||||
},
|
||||
};`,
|
||||
]);
|
||||
|
||||
assert.match(stderr, /^Thrown at:$/m);
|
||||
assert.match(stderr, /^ {4}at \[eval\]:1:1$/m);
|
||||
assert.strictEqual(code, 1);
|
||||
assert.strictEqual(signal, null);
|
||||
});
|
||||
});
|
||||
21
test/parallel/test-throw-undefined-or-null-traced.mjs
Normal file
21
test/parallel/test-throw-undefined-or-null-traced.mjs
Normal file
@@ -0,0 +1,21 @@
|
||||
import { spawnPromisified } from '../common/index.mjs';
|
||||
import assert from 'node:assert';
|
||||
import { execPath } from 'node:process';
|
||||
import { describe, it } from 'node:test';
|
||||
|
||||
|
||||
describe('--trace-uncaught', () => {
|
||||
it('prints a trace on process exit for uncaught errors', async () => {
|
||||
for (const value of [null, undefined]) {
|
||||
const { code, signal, stderr } = await spawnPromisified(execPath, [
|
||||
'--trace-uncaught',
|
||||
'--eval',
|
||||
`throw ${value};`,
|
||||
]);
|
||||
assert.match(stderr, /^Thrown at:$/m);
|
||||
assert.match(stderr, /^ {4}at \[eval\]:1:1$/m);
|
||||
assert.strictEqual(code, 1);
|
||||
assert.strictEqual(signal, null);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user