Skip to content

Commit c7e23d6

Browse files
committed
test: migrate snapshot from python to js
1 parent a2de5b9 commit c7e23d6

23 files changed

+142
-394
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44
const assert = require('assert').strict;
55

66
assert.throws(() => { throw new Error('foo'); }, { bar: true });

test/message/assert_throws_stack.out renamed to test/fixtures/errors/assert_throws_stack.snapshot

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
99
- Comparison {
1010
- bar: true
1111
- }
12-
at Object.<anonymous> (*assert_throws_stack.js:*:*)
12+
13+
at *
1314
at *
1415
at *
1516
at *
@@ -21,16 +22,16 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
2122
generatedMessage: true,
2223
code: 'ERR_ASSERTION',
2324
actual: Error: foo
24-
at assert.throws.bar (*assert_throws_stack.js:*)
25-
at getActual (node:assert:*)
26-
at Function.throws (node:assert:*)
27-
at Object.<anonymous> (*assert_throws_stack.js:*:*)
2825
at *
2926
at *
3027
at *
3128
at *
3229
at *
33-
at *,
30+
at *
31+
at *
32+
at *
33+
at *
34+
at wrapModuleLoad (node:internal*modules*cjs*loader:*:*),
3435
expected: { bar: true },
3536
operator: 'throws'
3637
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44

55
console.assert(false, Symbol('hello'));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Assertion failed Symbol(hello)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
// Flags: --expose-internals
4-
require('../common');
4+
require('../../common');
55

66
const assert = require('internal/assert');
77
assert(false);

test/message/internal_assert.out renamed to test/fixtures/errors/internal_assert.snapshot

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
node:internal/assert:*
1+
node:internal*assert:*
22
throw new ERR_INTERNAL_ASSERTION(message);
33
^
44

55
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
6-
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
6+
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues
77

8-
at assert (node:internal/assert:*:*)
9-
at * (*test*message*internal_assert.js:7:1)
8+
at *
9+
at *
1010
at *
1111
at *
1212
at *
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
// Flags: --expose-internals
4-
require('../common');
4+
require('../../common');
55

66
const assert = require('internal/assert');
77
assert.fail('Unreachable!');

test/message/internal_assert_fail.out renamed to test/fixtures/errors/internal_assert_fail.snapshot

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
node:internal/assert:*
1+
node:internal*assert:*
22
throw new ERR_INTERNAL_ASSERTION(message);
33
^
44

55
Error [ERR_INTERNAL_ASSERTION]: Unreachable!
66
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
7-
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
7+
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues
88

9-
at Function.fail (node:internal/assert:*:*)
10-
at * (*test*message*internal_assert_fail.js:7:8)
9+
at *
10+
at *
1111
at *
1212
at *
1313
at *

test/message/max_tick_depth.js renamed to test/fixtures/errors/max_tick_depth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
require('../../common');
2424

2525
process.maxTickDepth = 10;
2626
let i = 20;

test/message/nexttick_throw.js renamed to test/fixtures/errors/nexttick_throw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
require('../../common');
2424

2525
process.nextTick(function() {
2626
process.nextTick(function() {
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
2-
*test*message*nexttick_throw.js:*
1+
*nexttick_throw.js:*
32
undefined_reference_error_maker;
43
^
4+
55
ReferenceError: undefined_reference_error_maker is not defined
6-
at *test*message*nexttick_throw.js:*:*
7-
at process.processTicksAndRejections (node:internal/process/task_queues:*:*)
6+
at *nexttick_throw.js:*:*
7+
at process.processTicksAndRejections (node:internal*process*task_queues:*:*)
88

99
Node.js *

test/message/node_run_non_existent.js renamed to test/fixtures/errors/node_run_non_existent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44
const assert = require('node:assert').strict;
55
const childProcess = require('node:child_process');
6-
const fixtures = require('../common/fixtures');
6+
const fixtures = require('../../common/fixtures');
77

88
const child = childProcess.spawnSync(
99
process.execPath,

test/message/node_run_non_existent.out renamed to test/fixtures/errors/node_run_non_existent.snapshot

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Missing script: "non-existent-command" for *
1+
Missing script: "non-existent-command" for *fixtures*run-script*package.json
22

33
Available scripts are:
44
test: echo "Error: no test specified" && exit 1
@@ -14,3 +14,4 @@ Available scripts are:
1414
special-env-variables-windows: special-env-variables.bat
1515
pwd: pwd
1616
pwd-windows: cd
17+

test/message/util_inspect_error.js renamed to test/fixtures/errors/util_inspect_error.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44
const util = require('util');
55

66
const err = new Error('foo\nbar');

test/message/util_inspect_error.out renamed to test/fixtures/errors/util_inspect_error.snapshot

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{ err:
22
Error: foo
33
bar
4-
at *util_inspect_error*
54
at *
65
at *
76
at *
@@ -10,11 +9,11 @@
109
at *
1110
at *
1211
at *
12+
at node:internal*main*run_main_module:*:*,
1313
nested:
1414
{ err:
1515
Error: foo
1616
bar
17-
at *util_inspect_error*
1817
at *
1918
at *
2019
at *
@@ -23,10 +22,10 @@
2322
at *
2423
at *
2524
at *
25+
at node:internal*main*run_main_module:*:* } }
2626
{
2727
err: Error: foo
2828
bar
29-
at *util_inspect_error*
3029
at *
3130
at *
3231
at *
@@ -35,10 +34,11 @@
3534
at *
3635
at *
3736
at *
37+
at node:internal*main*run_main_module:*:*,
3838
nested: {
3939
err: Error: foo
4040
bar
41-
at *util_inspect_error*
41+
at *
4242
at *
4343
at *
4444
at *
@@ -51,7 +51,7 @@
5151
}
5252
{ Error: foo
5353
bar
54-
at *util_inspect_error*
54+
at *
5555
at *
5656
at *
5757
at *

test/message/util-inspect-error-cause.js renamed to test/fixtures/errors/util_inspect_error_cause.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44

55
const { inspect } = require('util');
66

77
class FoobarError extends Error {
88
status = 'Feeling good';
99
}
1010

11+
Error.stackTraceLimit = 1
12+
1113
const cause1 = new TypeError('Inner error');
1214
const cause2 = new FoobarError('Individual message', { cause: cause1 });
1315
cause2.extraProperties = 'Yes!';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Error: Number error cause
2+
at * {
3+
[cause]: 42
4+
}
5+
Error: Object cause
6+
at * {
7+
[cause]: {
8+
message: 'Unique',
9+
name: 'Error',
10+
stack: 'Error: Unique\n' +
11+
' at Module._compile (node:internal*modules*cjs*loader:*:*)'
12+
}
13+
}
14+
Error: undefined cause
15+
at * {
16+
[cause]: undefined
17+
}
18+
Error: cause that throws
19+
at * {
20+
[cause]: [Getter]
21+
}
22+
RangeError: New Stack Frames
23+
at * {
24+
[cause]: FoobarError: Individual message
25+
at Object.<anonymous> \x1B[90m(/\x1B[39mtest*util_inspect_error_cause.js:*:*\x1B[90m)\x1B[39m {
26+
status: \x1B[32m'Feeling good'\x1B[39m,
27+
extraProperties: \x1B[32m'Yes!'\x1B[39m,
28+
[cause]: TypeError: Inner error
29+
at Object.<anonymous> \x1B[90m(/\x1B[39mtest*util_inspect_error_cause.js:*:*\x1B[90m)\x1B[39m
30+
}
31+
}
32+
Error: Stack causes
33+
at *
34+
*[90m at *[39m
35+
*[90m ... 6 lines matching cause stack trace ...*[39m
36+
*[90m at *[39m {
37+
[cause]: FoobarError: Individual message
38+
at Object.<anonymous> \x1B[90m(/\x1B[39mtest*util_inspect_error_cause.js:*:*\x1B[90m)\x1B[39m {
39+
status: \x1B[32m'Feeling good'\x1B[39m,
40+
extraProperties: \x1B[32m'Yes!'\x1B[39m,
41+
[cause]: TypeError: Inner error
42+
at *
43+
}
44+
}
45+
RangeError: New Stack Frames
46+
at *
47+
*[90m at *[39m {
48+
[cause]: Error: Stack causes
49+
at *
50+
*[90m at *[39m
51+
*[90m ... 6 lines matching cause stack trace ...*[39m
52+
*[90m at *[39m {
53+
[cause]: FoobarError: Individual message
54+
at Object.<anonymous> \x1B[90m(/\x1B[39mtest*util_inspect_error_cause.js:*:*\x1B[90m)\x1B[39m {
55+
status: \x1B[32m'Feeling good'\x1B[39m,
56+
extraProperties: \x1B[32m'Yes!'\x1B[39m,
57+
[cause]: TypeError: Inner error
58+
at Object.<anonymous> \x1B[90m(/\x1B[39mtest*util_inspect_error_cause.js:*:*\x1B[90m)\x1B[39m
59+
}
60+
}
61+
}
62+
RangeError: New Stack Frames
63+
at * {
64+
[cause]: FoobarError: Individual message
65+
at * {
66+
status: 'Feeling good',
67+
extraProperties: 'Yes!',
68+
[cause]: TypeError: Inner error
69+
at *
70+
}
71+
}
72+
Error: Stack causes
73+
at * {
74+
[cause]: FoobarError: Individual message
75+
at * {
76+
status: 'Feeling good',
77+
extraProperties: 'Yes!',
78+
[cause]: TypeError: Inner error
79+
at *
80+
}
81+
}
82+
RangeError: New Stack Frames
83+
at * {
84+
[cause]: Error: Stack causes
85+
at * {
86+
[cause]: FoobarError: Individual message
87+
at * {
88+
status: 'Feeling good',
89+
extraProperties: 'Yes!',
90+
[cause]: TypeError: Inner error
91+
at *
92+
}
93+
}
94+
}

test/message/console_assert.out

-1
This file was deleted.

test/message/message.status

-19
This file was deleted.

0 commit comments

Comments
 (0)