From 3e255df1224364f7fe736b02078c4be40c992307 Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Tue, 9 Aug 2022 22:26:58 -0700 Subject: [PATCH] test: remove cjs loader from stack traces --- .../throw-error-with-getter-throw-traced.mjs | 27 ++++++++++++++++++ test/errors/throw-null-traced.mjs | 20 +++++++++++++ test/errors/throw-undefined-traced.mjs | 20 +++++++++++++ test/message/core_line_numbers.js | 2 ++ test/message/core_line_numbers.out | 6 ---- test/message/error_aggregateTwoErrors.js | 2 ++ test/message/error_aggregateTwoErrors.out | 25 ++-------------- test/message/error_exit.js | 2 ++ test/message/error_exit.out | 8 +----- test/message/error_with_nul.js | 1 + test/message/error_with_nul.out | Bin 556 -> 174 bytes .../events_unhandled_error_common_trace.js | 2 ++ .../events_unhandled_error_common_trace.out | 10 ------- .../events_unhandled_error_nexttick.js | 2 ++ .../events_unhandled_error_nexttick.out | 7 ----- .../events_unhandled_error_sameline.js | 2 ++ .../events_unhandled_error_sameline.out | 9 ------ .../events_unhandled_error_subclass.js | 2 ++ .../events_unhandled_error_subclass.out | 9 ------ test/message/if-error-has-good-stack.js | 2 ++ test/message/if-error-has-good-stack.out | 16 ++--------- test/message/source_map_disabled_by_api.js | 1 + test/message/source_map_disabled_by_api.out | 10 ------- test/message/source_map_enabled_by_api.js | 1 + test/message/source_map_enabled_by_api.out | 10 ------- test/message/source_map_enclosing_function.js | 2 ++ .../message/source_map_enclosing_function.out | 5 ---- test/message/source_map_eval.js | 2 ++ test/message/source_map_eval.out | 8 +----- test/message/source_map_no_source_file.js | 1 + test/message/source_map_no_source_file.out | 8 ------ .../source_map_reference_error_tabs.js | 2 ++ .../source_map_reference_error_tabs.out | 8 ------ test/message/source_map_throw_catch.js | 2 ++ test/message/source_map_throw_catch.out | 8 ------ test/message/source_map_throw_first_tick.js | 2 ++ test/message/source_map_throw_first_tick.out | 8 ------ test/message/source_map_throw_icu.js | 2 ++ test/message/source_map_throw_icu.out | 8 ------ .../test-no-extra-info-on-fatal-exception.js | 1 + .../test-no-extra-info-on-fatal-exception.out | 10 ++----- .../throw_error_with_getter_throw_traced.js | 11 ------- .../throw_error_with_getter_throw_traced.out | 15 ---------- test/message/throw_null_traced.js | 6 ---- test/message/throw_null_traced.out | 15 ---------- test/message/throw_undefined_traced.js | 6 ---- test/message/throw_undefined_traced.out | 15 ---------- .../undefined_reference_in_new_context.js | 2 +- .../undefined_reference_in_new_context.out | 11 ++----- test/message/vm_display_runtime_error.js | 2 ++ test/message/vm_display_runtime_error.out | 12 -------- test/message/vm_display_syntax_error.js | 2 ++ test/message/vm_display_syntax_error.out | 12 -------- test/message/vm_dont_display_runtime_error.js | 2 ++ .../message/vm_dont_display_runtime_error.out | 6 ---- test/message/vm_dont_display_syntax_error.js | 2 ++ test/message/vm_dont_display_syntax_error.out | 6 ---- 57 files changed, 121 insertions(+), 277 deletions(-) create mode 100644 test/errors/throw-error-with-getter-throw-traced.mjs create mode 100644 test/errors/throw-null-traced.mjs create mode 100644 test/errors/throw-undefined-traced.mjs delete mode 100644 test/message/throw_error_with_getter_throw_traced.js delete mode 100644 test/message/throw_error_with_getter_throw_traced.out delete mode 100644 test/message/throw_null_traced.js delete mode 100644 test/message/throw_null_traced.out delete mode 100644 test/message/throw_undefined_traced.js delete mode 100644 test/message/throw_undefined_traced.out diff --git a/test/errors/throw-error-with-getter-throw-traced.mjs b/test/errors/throw-error-with-getter-throw-traced.mjs new file mode 100644 index 00000000000000..08dbaf155d2abe --- /dev/null +++ b/test/errors/throw-error-with-getter-throw-traced.mjs @@ -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:/); + assert.match(stderr, / at \[eval\]:1:1/); + assert.strictEqual(code, 1); + assert.strictEqual(signal, null); + }); +}); diff --git a/test/errors/throw-null-traced.mjs b/test/errors/throw-null-traced.mjs new file mode 100644 index 00000000000000..eec4279e95b00c --- /dev/null +++ b/test/errors/throw-null-traced.mjs @@ -0,0 +1,20 @@ +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 null;', + ]); + + assert.match(stderr, /Thrown at:/); + assert.match(stderr, / at \[eval\]:1:1/); + assert.strictEqual(code, 1); + assert.strictEqual(signal, null); + }); +}); diff --git a/test/errors/throw-undefined-traced.mjs b/test/errors/throw-undefined-traced.mjs new file mode 100644 index 00000000000000..22fc9afee1c439 --- /dev/null +++ b/test/errors/throw-undefined-traced.mjs @@ -0,0 +1,20 @@ +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 undefined;', + ]); + + assert.match(stderr, /Thrown at:/); + assert.match(stderr, / at \[eval\]:1:1/); + assert.strictEqual(code, 1); + assert.strictEqual(signal, null); + }); +}); diff --git a/test/message/core_line_numbers.js b/test/message/core_line_numbers.js index 221001ed8952d0..585a6042652df1 100644 --- a/test/message/core_line_numbers.js +++ b/test/message/core_line_numbers.js @@ -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. diff --git a/test/message/core_line_numbers.out b/test/message/core_line_numbers.out index bdba01a223c08f..ee439cac2f4354 100644 --- a/test/message/core_line_numbers.out +++ b/test/message/core_line_numbers.out @@ -6,11 +6,5 @@ RangeError: Invalid input at error (node:punycode:52:8) at Object.decode (node:punycode:*:*) at Object. (*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 * diff --git a/test/message/error_aggregateTwoErrors.js b/test/message/error_aggregateTwoErrors.js index a59a6b5788d4c2..6cb6cce095b295 100644 --- a/test/message/error_aggregateTwoErrors.js +++ b/test/message/error_aggregateTwoErrors.js @@ -2,6 +2,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 1; + const { aggregateTwoErrors } = require('internal/errors'); const originalError = new Error('original'); diff --git a/test/message/error_aggregateTwoErrors.out b/test/message/error_aggregateTwoErrors.out index 9dd1b206f15208..243c391fd4faaa 100644 --- a/test/message/error_aggregateTwoErrors.out +++ b/test/message/error_aggregateTwoErrors.out @@ -1,34 +1,15 @@ *error_aggregateTwoErrors.js:* throw aggregateTwoErrors(err, originalError); ^ -AggregateError: original - at Object. (*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. (*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. (/Users/geoffrey/Sites/node/test/message/error_aggregateTwoErrors.js:*:*) { code: 'ERR0' }, Error: second error - at Object. (*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. (/Users/geoffrey/Sites/node/test/message/error_aggregateTwoErrors.js:*:*) { code: 'ERR1' } ] diff --git a/test/message/error_exit.js b/test/message/error_exit.js index 057a371df24851..51d303015fd8ac 100644 --- a/test/message/error_exit.js +++ b/test/message/error_exit.js @@ -21,6 +21,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 1; + const assert = require('assert'); process.on('exit', function(code) { diff --git a/test/message/error_exit.out b/test/message/error_exit.out index d10abedb0880ae..4ee2f083b63569 100644 --- a/test/message/error_exit.out +++ b/test/message/error_exit.out @@ -7,13 +7,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 1 !== 2 - at Object. (*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. (*test*message*error_exit.js:*:*) { generatedMessage: true, code: 'ERR_ASSERTION', actual: 1, diff --git a/test/message/error_with_nul.js b/test/message/error_with_nul.js index 2849e9d21c878c..de49c383fd41a0 100644 --- a/test/message/error_with_nul.js +++ b/test/message/error_with_nul.js @@ -1,5 +1,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; function test() { const a = 'abc\0def'; diff --git a/test/message/error_with_nul.out b/test/message/error_with_nul.out index 91b22a240231aa92e3facb90c42751de95df2f33..7dd4d665555874863591d5ba33d4833ebea75717 100644 GIT binary patch delta 18 ZcmZ3(vW{`WVs0+K{FGF^tYQT%E&w|G1&sgz literal 556 zcmbV|yG{c!5Jgk_D_kZnyuCqmp-Z5lLSRk26U8fgjQr3hf6wefBtRgfbvM5E%;Unr zt$I8Pg*m5eM_*5tTF^r=N=R8xIgOHVl-o&P!{&y6Uxk=UBjFR5{GiHXqZL6!x&E!6 zQ5%M5r#C4fk#m4(Riwu2|^cVxpZzQT}aSlHtNg3 zD~;!hRD7bM`Nm~UruNH7y8yj! (*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. (*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 * diff --git a/test/message/events_unhandled_error_nexttick.js b/test/message/events_unhandled_error_nexttick.js index 713031eeefa042..bf508c9788757d 100644 --- a/test/message/events_unhandled_error_nexttick.js +++ b/test/message/events_unhandled_error_nexttick.js @@ -1,5 +1,7 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 1; + const EventEmitter = require('events'); const er = new Error(); process.nextTick(() => { diff --git a/test/message/events_unhandled_error_nexttick.out b/test/message/events_unhandled_error_nexttick.out index a5a220da44f94b..7b616c22e37302 100644 --- a/test/message/events_unhandled_error_nexttick.out +++ b/test/message/events_unhandled_error_nexttick.out @@ -4,14 +4,7 @@ node:events:* Error at Object. (*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 * diff --git a/test/message/events_unhandled_error_sameline.js b/test/message/events_unhandled_error_sameline.js index 1e5e77d08c9919..6dad22dd58e393 100644 --- a/test/message/events_unhandled_error_sameline.js +++ b/test/message/events_unhandled_error_sameline.js @@ -1,4 +1,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 1; + const EventEmitter = require('events'); new EventEmitter().emit('error', new Error()); diff --git a/test/message/events_unhandled_error_sameline.out b/test/message/events_unhandled_error_sameline.out index f60b0f8572dd5e..dd12176259badf 100644 --- a/test/message/events_unhandled_error_sameline.out +++ b/test/message/events_unhandled_error_sameline.out @@ -4,16 +4,7 @@ node:events:* Error at Object. (*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. (*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 * diff --git a/test/message/events_unhandled_error_subclass.js b/test/message/events_unhandled_error_subclass.js index 8303cb2237dc1e..5fc3bc26fb4e93 100644 --- a/test/message/events_unhandled_error_subclass.js +++ b/test/message/events_unhandled_error_subclass.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()); diff --git a/test/message/events_unhandled_error_subclass.out b/test/message/events_unhandled_error_subclass.out index 6733809a8ccaab..3d5d0307e6d792 100644 --- a/test/message/events_unhandled_error_subclass.out +++ b/test/message/events_unhandled_error_subclass.out @@ -4,16 +4,7 @@ node:events:* Error at Object. (*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. (*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 * diff --git a/test/message/if-error-has-good-stack.js b/test/message/if-error-has-good-stack.js index 1db25d2fa55a1b..4f529d3e5d17ff 100644 --- a/test/message/if-error-has-good-stack.js +++ b/test/message/if-error-has-good-stack.js @@ -1,6 +1,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 4; + const assert = require('assert'); let err; diff --git a/test/message/if-error-has-good-stack.out b/test/message/if-error-has-good-stack.out index 6ded3280d20aa1..e394127bd4c473 100644 --- a/test/message/if-error-has-good-stack.out +++ b/test/message/if-error-has-good-stack.out @@ -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. (*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. (*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. (*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. (*if-error-has-good-stack.js:*:*), expected: null, operator: 'ifError' } diff --git a/test/message/source_map_disabled_by_api.js b/test/message/source_map_disabled_by_api.js index db55d24e1d5df8..93c87f10c14931 100644 --- a/test/message/source_map_disabled_by_api.js +++ b/test/message/source_map_disabled_by_api.js @@ -2,6 +2,7 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 5; process.setSourceMapsEnabled(false); diff --git a/test/message/source_map_disabled_by_api.out b/test/message/source_map_disabled_by_api.out index f3f93758c1d272..655cd6695e1116 100644 --- a/test/message/source_map_disabled_by_api.out +++ b/test/message/source_map_disabled_by_api.out @@ -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. (*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. (*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:*) diff --git a/test/message/source_map_enabled_by_api.js b/test/message/source_map_enabled_by_api.js index 29e0f9708903a8..f0308b19598988 100644 --- a/test/message/source_map_enabled_by_api.js +++ b/test/message/source_map_enabled_by_api.js @@ -1,5 +1,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 5; process.setSourceMapsEnabled(true); diff --git a/test/message/source_map_enabled_by_api.out b/test/message/source_map_enabled_by_api.out index 97547436db091b..082b3f310ed4f9 100644 --- a/test/message/source_map_enabled_by_api.out +++ b/test/message/source_map_enabled_by_api.out @@ -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. (*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. (*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:*) diff --git a/test/message/source_map_enclosing_function.js b/test/message/source_map_enclosing_function.js index 43b6931bf1e19e..f77bd818f02d78 100644 --- a/test/message/source_map_enclosing_function.js +++ b/test/message/source_map_enclosing_function.js @@ -2,4 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 5; + require('../fixtures/source-map/enclosing-call-site-min.js'); diff --git a/test/message/source_map_enclosing_function.out b/test/message/source_map_enclosing_function.out index 7a09c6b92ca41d..5bb920e7eba42a 100644 --- a/test/message/source_map_enclosing_function.out +++ b/test/message/source_map_enclosing_function.out @@ -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. (*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 * diff --git a/test/message/source_map_eval.js b/test/message/source_map_eval.js index 534d16bd34c28f..404793f05412e4 100644 --- a/test/message/source_map_eval.js +++ b/test/message/source_map_eval.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'); diff --git a/test/message/source_map_eval.out b/test/message/source_map_eval.out index 5fdf5df4e4c80b..5d97e137f7f824 100644 --- a/test/message/source_map_eval.out +++ b/test/message/source_map_eval.out @@ -5,12 +5,6 @@ ReferenceError: alert is not defined at Object.eval (*tabs.coffee:26:2) at eval (*tabs.coffee:1:14) - at Object. (*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. (*source_map_eval.js:*:*) Node.js * diff --git a/test/message/source_map_no_source_file.js b/test/message/source_map_no_source_file.js index 971fa5e271550b..53c53416248b77 100644 --- a/test/message/source_map_no_source_file.js +++ b/test/message/source_map_no_source_file.js @@ -2,5 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; require('../fixtures/source-map/no-source.js'); diff --git a/test/message/source_map_no_source_file.out b/test/message/source_map_no_source_file.out index aa39992a81de74..cf9329747ba692 100644 --- a/test/message/source_map_no_source_file.out +++ b/test/message/source_map_no_source_file.out @@ -5,13 +5,5 @@ Error: foo at Throw (*file-not-exists.ts:2:9) at Object. (*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. (*source_map_no_source_file.js:6:1) - at Module._compile (node:internal/modules/cjs/loader:*) Node.js * diff --git a/test/message/source_map_reference_error_tabs.js b/test/message/source_map_reference_error_tabs.js index f6a39d9d497449..fbe058a5f531bf 100644 --- a/test/message/source_map_reference_error_tabs.js +++ b/test/message/source_map_reference_error_tabs.js @@ -2,4 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; + require('../fixtures/source-map/tabs.js'); diff --git a/test/message/source_map_reference_error_tabs.out b/test/message/source_map_reference_error_tabs.out index be31c07810edef..7bf2d13305ef12 100644 --- a/test/message/source_map_reference_error_tabs.out +++ b/test/message/source_map_reference_error_tabs.out @@ -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. (*source_map_reference_error_tabs.js:* - at Module._compile (node:internal/modules/cjs/loader:* Node.js * diff --git a/test/message/source_map_throw_catch.js b/test/message/source_map_throw_catch.js index f3a887474bfbac..603fa81867bcbe 100644 --- a/test/message/source_map_throw_catch.js +++ b/test/message/source_map_throw_catch.js @@ -2,6 +2,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; + try { require('../fixtures/source-map/typescript-throw'); } catch (err) { diff --git a/test/message/source_map_throw_catch.out b/test/message/source_map_throw_catch.out index c66aa43d063019..662d4b5bee4dab 100644 --- a/test/message/source_map_throw_catch.out +++ b/test/message/source_map_throw_catch.out @@ -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. (*source_map_throw_catch.js:6:3) - at Module._compile (node:internal/modules/cjs/loader:*) diff --git a/test/message/source_map_throw_first_tick.js b/test/message/source_map_throw_first_tick.js index b691b51f355194..9bf1a353cf18be 100644 --- a/test/message/source_map_throw_first_tick.js +++ b/test/message/source_map_throw_first_tick.js @@ -2,4 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; + require('../fixtures/source-map/typescript-throw'); diff --git a/test/message/source_map_throw_first_tick.out b/test/message/source_map_throw_first_tick.out index 9769127c39bdbc..792be67aae089f 100644 --- a/test/message/source_map_throw_first_tick.out +++ b/test/message/source_map_throw_first_tick.out @@ -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. (*source_map_throw_first_tick.js:5:1) - at Module._compile (node:internal/modules/cjs/loader:*) Node.js * diff --git a/test/message/source_map_throw_icu.js b/test/message/source_map_throw_icu.js index 00298edc5ed81a..672c1575c6547a 100644 --- a/test/message/source_map_throw_icu.js +++ b/test/message/source_map_throw_icu.js @@ -2,4 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 2; + require('../fixtures/source-map/icu'); diff --git a/test/message/source_map_throw_icu.out b/test/message/source_map_throw_icu.out index d9a82958395650..65297956f92437 100644 --- a/test/message/source_map_throw_icu.out +++ b/test/message/source_map_throw_icu.out @@ -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. (*source_map_throw_icu.js:* - at Module._compile (node:internal/modules/cjs/loader:* Node.js * diff --git a/test/message/test-no-extra-info-on-fatal-exception.js b/test/message/test-no-extra-info-on-fatal-exception.js index 948274d2bb5491..dbc61b0f2382e0 100644 --- a/test/message/test-no-extra-info-on-fatal-exception.js +++ b/test/message/test-no-extra-info-on-fatal-exception.js @@ -2,5 +2,6 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 1; throw new Error('foo'); diff --git a/test/message/test-no-extra-info-on-fatal-exception.out b/test/message/test-no-extra-info-on-fatal-exception.out index 0390dacb8d5f42..d26573344cc41a 100644 --- a/test/message/test-no-extra-info-on-fatal-exception.out +++ b/test/message/test-no-extra-info-on-fatal-exception.out @@ -1,12 +1,6 @@ -*:6 +*:7 throw new Error('foo'); ^ Error: foo - at Object. (*: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. (*:7:7) diff --git a/test/message/throw_error_with_getter_throw_traced.js b/test/message/throw_error_with_getter_throw_traced.js deleted file mode 100644 index 609bd9caf83fe2..00000000000000 --- a/test/message/throw_error_with_getter_throw_traced.js +++ /dev/null @@ -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'); - }, -}; diff --git a/test/message/throw_error_with_getter_throw_traced.out b/test/message/throw_error_with_getter_throw_traced.out deleted file mode 100644 index 87310042ad2213..00000000000000 --- a/test/message/throw_error_with_getter_throw_traced.out +++ /dev/null @@ -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 * diff --git a/test/message/throw_null_traced.js b/test/message/throw_null_traced.js deleted file mode 100644 index fee8928f887403..00000000000000 --- a/test/message/throw_null_traced.js +++ /dev/null @@ -1,6 +0,0 @@ -// Flags: --trace-uncaught -'use strict'; -require('../common'); - -// eslint-disable-next-line no-throw-literal -throw null; diff --git a/test/message/throw_null_traced.out b/test/message/throw_null_traced.out deleted file mode 100644 index 0344dc27e0a428..00000000000000 --- a/test/message/throw_null_traced.out +++ /dev/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 * diff --git a/test/message/throw_undefined_traced.js b/test/message/throw_undefined_traced.js deleted file mode 100644 index f6ded43378dc91..00000000000000 --- a/test/message/throw_undefined_traced.js +++ /dev/null @@ -1,6 +0,0 @@ -// Flags: --trace-uncaught -'use strict'; -require('../common'); - -// eslint-disable-next-line no-throw-literal -throw undefined; diff --git a/test/message/throw_undefined_traced.out b/test/message/throw_undefined_traced.out deleted file mode 100644 index 148085f094a8d0..00000000000000 --- a/test/message/throw_undefined_traced.out +++ /dev/null @@ -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 * diff --git a/test/message/undefined_reference_in_new_context.js b/test/message/undefined_reference_in_new_context.js index 7cb68ec5b3b3df..29a67632f8f7dd 100644 --- a/test/message/undefined_reference_in_new_context.js +++ b/test/message/undefined_reference_in_new_context.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'); diff --git a/test/message/undefined_reference_in_new_context.out b/test/message/undefined_reference_in_new_context.out index 3bfa1c5b967dd8..8d8228bd902950 100644 --- a/test/message/undefined_reference_in_new_context.out +++ b/test/message/undefined_reference_in_new_context.out @@ -1,18 +1,13 @@ before evalmachine.:1 -foo.bar = 5; -^ +Error.stackTraceLimit = 5; foo.bar = 5; + ^ ReferenceError: foo is not defined - at evalmachine.:1:1 + at evalmachine.:*:* at Script.runInContext (node:vm:*) at Script.runInNewContext (node:vm:*) at Object.runInNewContext (node:vm:*) at Object. (*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 * diff --git a/test/message/vm_display_runtime_error.js b/test/message/vm_display_runtime_error.js index 3ebbb1464d135d..80505cb02f3f3b 100644 --- a/test/message/vm_display_runtime_error.js +++ b/test/message/vm_display_runtime_error.js @@ -21,6 +21,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 4; + const vm = require('vm'); console.error('beginning'); diff --git a/test/message/vm_display_runtime_error.out b/test/message/vm_display_runtime_error.out index 857525e4a4768a..6dc8a703b4b7cd 100644 --- a/test/message/vm_display_runtime_error.out +++ b/test/message/vm_display_runtime_error.out @@ -8,12 +8,6 @@ Error: boo! at Script.runInThisContext (node:vm:*) at Object.runInThisContext (node:vm:*) at Object. (*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. (*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 * diff --git a/test/message/vm_display_syntax_error.js b/test/message/vm_display_syntax_error.js index ac9b4d17bd147b..f47d8d477ececc 100644 --- a/test/message/vm_display_syntax_error.js +++ b/test/message/vm_display_syntax_error.js @@ -21,6 +21,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 4; + const vm = require('vm'); console.error('beginning'); diff --git a/test/message/vm_display_syntax_error.out b/test/message/vm_display_syntax_error.out index 427f593e9e9a21..371ebfccdc3e1d 100644 --- a/test/message/vm_display_syntax_error.out +++ b/test/message/vm_display_syntax_error.out @@ -7,12 +7,6 @@ SyntaxError: Unexpected number at createScript (node:vm:*) at Object.runInThisContext (node:vm:*) at Object. (*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. (*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 * diff --git a/test/message/vm_dont_display_runtime_error.js b/test/message/vm_dont_display_runtime_error.js index 49203684ed6609..44bdaf42d9b234 100644 --- a/test/message/vm_dont_display_runtime_error.js +++ b/test/message/vm_dont_display_runtime_error.js @@ -21,6 +21,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 4; + const vm = require('vm'); console.error('beginning'); diff --git a/test/message/vm_dont_display_runtime_error.out b/test/message/vm_dont_display_runtime_error.out index a2811489275b17..78b6a67c5aff2f 100644 --- a/test/message/vm_dont_display_runtime_error.out +++ b/test/message/vm_dont_display_runtime_error.out @@ -9,11 +9,5 @@ Error: boo! at Script.runInThisContext (node:vm:*) at Object.runInThisContext (node:vm:*) at Object. (*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 * diff --git a/test/message/vm_dont_display_syntax_error.js b/test/message/vm_dont_display_syntax_error.js index 38c49ad1a65315..01ab0b6395c69b 100644 --- a/test/message/vm_dont_display_syntax_error.js +++ b/test/message/vm_dont_display_syntax_error.js @@ -21,6 +21,8 @@ 'use strict'; require('../common'); +Error.stackTraceLimit = 4; + const vm = require('vm'); console.error('beginning'); diff --git a/test/message/vm_dont_display_syntax_error.out b/test/message/vm_dont_display_syntax_error.out index 2219ee7f2722ad..d7849361d5d230 100644 --- a/test/message/vm_dont_display_syntax_error.out +++ b/test/message/vm_dont_display_syntax_error.out @@ -9,11 +9,5 @@ SyntaxError: Unexpected number at createScript (node:vm:*) at Object.runInThisContext (node:vm:*) at Object. (*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 *