test: unify assertSnapshot common patterns · nodejs/node@b064ddc · GitHub
Skip to content

Commit b064ddc

Browse files
legendecasaduh95
authored andcommitted
test: unify assertSnapshot common patterns
Unifes assertSnapshot common patterns like platform specific path separators, line ending, line trailing spaces, Node.js version strings, and pids in warning messages. PR-URL: #61590 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent d147c08 commit b064ddc

100 files changed

Lines changed: 850 additions & 665 deletions

File tree

Some content is hidden

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

test/common/assertSnapshot.js

Lines changed: 57 additions & 12 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
before
2-
*test*fixtures*console*stack_overflow.js:*
2+
<project-root>/test/fixtures/console/stack_overflow.js:*
33
JSON.stringify(array);
44
^
55

66
[RangeError: Maximum call stack size exceeded]
77

8-
Node.js *
8+
Node.js <node-version>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Error: test
2-
at one (file:*/[eval1]:2:9)
3-
at two (file:*/[eval1]:15:9)
4-
at async three (file:*/[eval1]:18:3)
5-
at async four (file:*/[eval1]:22:3)
6-
at async main (file:*/[eval1]:28:5)
2+
at one (file://<project-root>/[eval1]:2:9)
3+
at two (file://<project-root>/[eval1]:15:9)
4+
at async three (file://<project-root>/[eval1]:18:3)
5+
at async four (file://<project-root>/[eval1]:22:3)
6+
at async main (file://<project-root>/[eval1]:28:5)
77

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Error: test
2-
at one (*fixtures*async-error.js:4:9)
3-
at two (*fixtures*async-error.js:17:9)
4-
at async three (*fixtures*async-error.js:20:3)
5-
at async four (*fixtures*async-error.js:24:3)
6-
at async main (*async_error_microtask_main.js:7:5)
2+
at one (<project-root>/test/fixtures/async-error.js:4:9)
3+
at two (<project-root>/test/fixtures/async-error.js:17:9)
4+
at async three (<project-root>/test/fixtures/async-error.js:20:3)
5+
at async four (<project-root>/test/fixtures/async-error.js:24:3)
6+
at async main (<project-root>/test/fixtures/errors/async_error_microtask_main.js:7:5)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Error: test
2-
at one (*fixtures*async-error.js:4:9)
3-
at two (*fixtures*async-error.js:17:9)
4-
at process.processTicksAndRejections (node:internal*process*task_queues:104:5)
5-
at async three (*fixtures*async-error.js:20:3)
6-
at async four (*fixtures*async-error.js:24:3)
7-
at async main (*async_error_nexttick_main.js:7:5)
2+
at one (<project-root>/test/fixtures/async-error.js:4:9)
3+
at two (<project-root>/test/fixtures/async-error.js:17:9)
4+
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
5+
at async three (<project-root>/test/fixtures/async-error.js:20:3)
6+
at async four (<project-root>/test/fixtures/async-error.js:24:3)
7+
at async main (<project-root>/test/fixtures/errors/async_error_nexttick_main.js:7:5)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Error: test
2-
at one (*fixtures*async-error.js:4:9)
3-
at two (*fixtures*async-error.js:17:9)
4-
at async three (*fixtures*async-error.js:20:3)
5-
at async four (*fixtures*async-error.js:24:3)
6-
at async main (file:*/async_error_sync_esm.mjs:6:5)
2+
at one (<project-root>/test/fixtures/async-error.js:4:9)
3+
at two (<project-root>/test/fixtures/async-error.js:17:9)
4+
at async three (<project-root>/test/fixtures/async-error.js:20:3)
5+
at async four (<project-root>/test/fixtures/async-error.js:24:3)
6+
at async main (file://<project-root>/test/fixtures/errors/async_error_sync_esm.mjs:6:5)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Error: test
2-
at one (*fixtures*async-error.js:4:9)
3-
at two (*fixtures*async-error.js:17:9)
4-
at async three (*fixtures*async-error.js:20:3)
5-
at async four (*fixtures*async-error.js:24:3)
6-
at async main (*async_error_sync_main.js:7:5)
2+
at one (<project-root>/test/fixtures/async-error.js:4:9)
3+
at two (<project-root>/test/fixtures/async-error.js:17:9)
4+
at async three (<project-root>/test/fixtures/async-error.js:20:3)
5+
at async four (<project-root>/test/fixtures/async-error.js:24:3)
6+
at async main (<project-root>/test/fixtures/errors/async_error_sync_main.js:7:5)

test/fixtures/errors/core_line_numbers.snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ node:punycode:54
55
RangeError: Invalid input
66
at error (node:punycode:54:8)
77
at Object.decode (node:punycode:247:5)
8-
at Object.<anonymous> (*core_line_numbers.js:13:10)
8+
at Object.<anonymous> (<project-root>/test/fixtures/errors/core_line_numbers.js:13:10)
99

10-
Node.js *
10+
Node.js <node-version>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
*error_aggregateTwoErrors.js:*
1+
<project-root>/test/fixtures/errors/error_aggregateTwoErrors.js:*
22
throw aggregateTwoErrors(err, originalError);
33
^
44

55
AggregateError: original
6-
at Object.<anonymous> (*error_aggregateTwoErrors.js:*:*) {
6+
at Object.<anonymous> (<project-root>/test/fixtures/errors/error_aggregateTwoErrors.js:*:*) {
77
code: 'ERR0',
88
[errors]: [
99
Error: original
10-
at Object.<anonymous> (*error_aggregateTwoErrors.js:*:*) {
10+
at Object.<anonymous> (<project-root>/test/fixtures/errors/error_aggregateTwoErrors.js:*:*) {
1111
code: 'ERR0'
1212
},
1313
Error: second error
14-
at Object.<anonymous> (*error_aggregateTwoErrors.js:*:*) {
14+
at Object.<anonymous> (<project-root>/test/fixtures/errors/error_aggregateTwoErrors.js:*:*) {
1515
code: 'ERR1'
1616
}
1717
]
1818
}
1919

20-
Node.js *
20+
Node.js <node-version>

test/fixtures/errors/error_exit.snapshot

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)