Skip to content

Commit d6e626d

Browse files
test: remove cjs loader from stack traces
PR-URL: #44197 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 7d92817 commit d6e626d

File tree

56 files changed

+102
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+102
-277
lines changed

test/message/core_line_numbers.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22
require('../common');
3+
Error.stackTraceLimit = 3;
4+
35
const punycode = require('punycode');
46

57
// This test verifies that line numbers in core modules are reported correctly.

test/message/core_line_numbers.out

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,5 @@ RangeError: Invalid input
66
at error (node:punycode:52:8)
77
at Object.decode (node:punycode:*:*)
88
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*)
9-
at Module._compile (node:internal/modules/cjs/loader:*:*)
10-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
11-
at Module.load (node:internal/modules/cjs/loader:*:*)
12-
at Module._load (node:internal/modules/cjs/loader:*:*)
13-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
14-
at node:internal/main/run_main_module:*:*
159

1610
Node.js *

test/message/error_aggregateTwoErrors.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
'use strict';
33

44
require('../common');
5+
Error.stackTraceLimit = 1;
6+
57
const { aggregateTwoErrors } = require('internal/errors');
68

79
const originalError = new Error('original');

test/message/error_aggregateTwoErrors.out

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,15 @@
11
*error_aggregateTwoErrors.js:*
22
throw aggregateTwoErrors(err, originalError);
33
^
4-
AggregateError: original
5-
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
6-
at Module._compile (node:internal/modules/cjs/loader:*:*)
7-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
8-
at Module.load (node:internal/modules/cjs/loader:*:*)
9-
at Module._load (node:internal/modules/cjs/loader:*:*)
10-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
11-
at node:internal/main/run_main_module:*:* {
4+
[AggregateError: original] {
125
code: 'ERR0',
136
[errors]: [
147
Error: original
15-
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
16-
at Module._compile (node:internal/modules/cjs/loader:*:*)
17-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
18-
at Module.load (node:internal/modules/cjs/loader:*:*)
19-
at Module._load (node:internal/modules/cjs/loader:*:*)
20-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
21-
at node:internal/main/run_main_module:*:* {
8+
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*) {
229
code: 'ERR0'
2310
},
2411
Error: second error
25-
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
26-
at Module._compile (node:internal/modules/cjs/loader:*:*)
27-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
28-
at Module.load (node:internal/modules/cjs/loader:*:*)
29-
at Module._load (node:internal/modules/cjs/loader:*:*)
30-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
31-
at node:internal/main/run_main_module:*:* {
12+
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*) {
3213
code: 'ERR1'
3314
}
3415
]

test/message/error_exit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
'use strict';
2323
require('../common');
24+
Error.stackTraceLimit = 1;
25+
2426
const assert = require('assert');
2527

2628
process.on('exit', function(code) {

test/message/error_exit.out

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
77

88
1 !== 2
99

10-
at Object.<anonymous> (*test*message*error_exit.js:*:*)
11-
at Module._compile (node:internal/modules/cjs/loader:*:*)
12-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
13-
at Module.load (node:internal/modules/cjs/loader:*:*)
14-
at Module._load (node:internal/modules/cjs/loader:*:*)
15-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
16-
at node:internal/main/run_main_module:*:* {
10+
at Object.<anonymous> (*test*message*error_exit.js:*:*) {
1711
generatedMessage: true,
1812
code: 'ERR_ASSERTION',
1913
actual: 1,

test/message/error_with_nul.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
require('../common');
3+
Error.stackTraceLimit = 2;
34

45
function test() {
56
const a = 'abc\0def';

test/message/error_with_nul.out

-382 Bytes
Binary file not shown.

test/message/events_unhandled_error_common_trace.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22
require('../common');
3+
Error.stackTraceLimit = 2;
4+
35
const EventEmitter = require('events');
46

57
function foo() {

test/message/events_unhandled_error_common_trace.out

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@ node:events:*
55
Error: foo:bar
66
at bar (*events_unhandled_error_common_trace.js:*:*)
77
at foo (*events_unhandled_error_common_trace.js:*:*)
8-
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
9-
at Module._compile (node:internal/modules/cjs/loader:*:*)
10-
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
11-
at Module.load (node:internal/modules/cjs/loader:*:*)
12-
at Module._load (node:internal/modules/cjs/loader:*:*)
13-
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
14-
at node:internal/main/run_main_module:*:*
158
Emitted 'error' event at:
169
at quux (*events_unhandled_error_common_trace.js:*:*)
1710
at Object.<anonymous> (*events_unhandled_error_common_trace.js:*:*)
18-
at Module._compile (node:internal/modules/cjs/loader:*:*)
19-
[... lines matching original stack trace ...]
20-
at node:internal/main/run_main_module:*:*
2111

2212
Node.js *

0 commit comments

Comments
 (0)