Skip to content

Commit 2df37de

Browse files
committed
test: migrate message tests to js fixtures squashed
test: migrate message tests to js fixtures squashed Add test runners to /parallel dir and fix snapshot Update test/parallel/test-node-output-tick.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-promise.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-assertion.mjs Co-authored-by: Moshe Atlow <[email protected]> Update test/parallel/test-node-output-map.mjs Co-authored-by: Moshe Atlow <[email protected]> fixed snapshot discrepancy with output-errors.mjs Corrected test runner name prefix Removing snapshots that show as 'new' on git diff Restored deleted files Deleted files restored
1 parent e2caafa commit 2df37de

40 files changed

+262
-60
lines changed

β€ŽBUILDING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ tools/test.py child-process
333333
```
334334

335335
You can also execute the tests in a test suite directory
336-
(such as `test/message`):
336+
(such as `test/report`):
337337

338-
```bash
339-
tools/test.py test/message
338+
```text
339+
$ tools/test.py test/report
340340
```
341341

342342
If you want to check the other options, please refer to the help by using
@@ -347,7 +347,7 @@ tools/test.py --help
347347
```
348348

349349
> Note: On Windows you should use `python3` executable.
350-
> Example: `python3 tools/test.py test/message`
350+
> Example: `python3 tools/test.py test/report`
351351
352352
You can usually run tests directly with node:
353353

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/assertion/assert_throws_stack.snapshot

Lines changed: 7 additions & 6 deletions
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+
at *
13+
at *
1314
at *
1415
at *
1516
at *
@@ -19,16 +20,16 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
1920
generatedMessage: true,
2021
code: 'ERR_ASSERTION',
2122
actual: Error: foo
22-
at assert.throws.bar (*assert_throws_stack.js:*)
23-
at getActual (node:assert:*)
24-
at Function.throws (node:assert:*)
25-
at Object.<anonymous> (*assert_throws_stack.js:*:*)
2623
at *
2724
at *
2825
at *
2926
at *
3027
at *
31-
at *,
28+
at *
29+
at *
30+
at *
31+
at *
32+
at node:internal*main*run_main_module:*:*,
3233
expected: { bar: true },
3334
operator: 'throws'
3435
}
Lines changed: 1 addition & 1 deletion
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/assertion/internal_assert.snapshot

Lines changed: 5 additions & 5 deletions
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]: 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 new NodeError (node:internal/errors:*:*)
9-
at assert (node:internal/assert:*:*)
10-
at * (*test*message*internal_assert.js:7:1)
8+
at *
9+
at *
10+
at *
1111
at *
1212
at *
1313
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/assertion/internal_assert_fail.snapshot

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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 new NodeError (node:internal/errors:*:*)
10-
at Function.fail (node:internal/assert:*:*)
11-
at * (*test*message*internal_assert_fail.js:7:8)
9+
at *
10+
at *
11+
at *
1212
at *
1313
at *
1414
at *

β€Žtest/message/core_line_numbers.js renamed to β€Žtest/fixtures/console/core_line_numbers.js

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

55
const punycode = require('punycode');

β€Žtest/message/eval_messages.js renamed to β€Žtest/fixtures/console/eval_messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
'use strict';
2323

24-
require('../common');
24+
require('../../common');
2525

2626
const spawn = require('child_process').spawn;
2727

β€Žtest/message/stdin_messages.js renamed to β€Žtest/fixtures/console/stdin_messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
'use strict';
2323

24-
require('../common');
24+
require('../../common');
2525

2626
const spawn = require('child_process').spawn;
2727

β€Žtest/message/if-error-has-good-stack.js renamed to β€Žtest/fixtures/errors/if-error-has-good-stack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
require('../common');
3+
require('../../common');
44
Error.stackTraceLimit = 4;
55

66
const assert = require('assert');

β€Žtest/message/if-error-has-good-stack.out renamed to β€Žtest/fixtures/errors/if-error-has-good-stack.snapshot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ node:assert:*
33
^
44

55
AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error
6-
at z (*if-error-has-good-stack.js:*:*
6+
at z (*if-error-has-good-stack.js:*:*)
77
at y (*if-error-has-good-stack.js:*:*)
88
at x (*if-error-has-good-stack.js:*:*)
99
at Object.<anonymous> (*if-error-has-good-stack.js:*:*)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Flags: --no-extra-info-on-fatal-exception
22

33
'use strict';
4-
require('../common');
4+
require('../../common');
55
Error.stackTraceLimit = 1;
66

77
throw new Error('foo');

β€Žtest/message/throw_error_with_getter_throw.js renamed to β€Žtest/fixtures/errors/throw_error_with_getter_throw.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
2-
require('../common');
2+
3+
require('../../common');
4+
35
throw { // eslint-disable-line no-throw-literal
46
get stack() {
57
throw new Error('weird throw but ok');

β€Žtest/message/throw_null.js renamed to β€Žtest/fixtures/errors/throw_null.js

Lines changed: 1 addition & 1 deletion
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
// eslint-disable-next-line no-throw-literal
2626
throw null;

β€Žtest/message/throw_undefined.js renamed to β€Žtest/fixtures/errors/throw_undefined.js

Lines changed: 1 addition & 1 deletion
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
// eslint-disable-next-line no-throw-literal
2626
throw undefined;

β€Žtest/message/timeout_throw.js renamed to β€Žtest/fixtures/errors/timeout_throw.js

Lines changed: 1 addition & 1 deletion
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
setTimeout(function() {
2626
// eslint-disable-next-line no-undef,no-unused-expressions

β€Žtest/message/undefined_reference_in_new_context.js renamed to β€Žtest/fixtures/errors/undefined_reference_in_new_context.js

Lines changed: 1 addition & 1 deletion
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
const vm = require('vm');
2525

2626
console.error('before');

β€Žtest/message/util-inspect-error-cause.js renamed to β€Žtest/fixtures/errors/util-inspect-error-cause.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

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

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

β€Žtest/message/util_inspect_error.js renamed to β€Žtest/fixtures/errors/util_inspect_error.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
{ err:
22
Error: foo
33
bar
4-
at *util_inspect_error*
54
at *
65
at *
76
at *
87
at *
98
at *
109
at *
10+
at node:internal*main*run_main_module:*:*,
1111
nested:
1212
{ err:
1313
Error: foo
1414
bar
15-
at *util_inspect_error*
1615
at *
1716
at *
1817
at *
1918
at *
2019
at *
2120
at *
21+
at node:internal*main*run_main_module:*:* } }
2222
{
2323
err: Error: foo
2424
bar
25-
at *util_inspect_error*
2625
at *
2726
at *
2827
at *
2928
at *
3029
at *
3130
at *
31+
at node:internal*main*run_main_module:*:*,
3232
nested: {
3333
err: Error: foo
3434
bar
35-
at *util_inspect_error*
35+
at *
3636
at *
3737
at *
3838
at *
@@ -43,7 +43,7 @@
4343
}
4444
{ Error: foo
4545
bar
46-
at *util_inspect_error*
46+
at *
4747
at *
4848
at *
4949
at *

β€Žtest/message/v8_warning.js renamed to β€Žtest/fixtures/errors/v8_warning.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

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

55
function AsmModule() {
66
'use asm';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Flags: --enable-source-maps
2+
3+
'use strict';
4+
require('../../common');
5+
Error.stackTraceLimit = 5;
6+
7+
require('../source-map/enclosing-call-site-min.js');

β€Žtest/message/source_map_enclosing_function.out renamed to β€Žtest/fixtures/map/source_map_enclosing_function.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
throw err
33
^
44

5+
56
Error: an error!
67
at functionD (*enclosing-call-site.js:16:17)
78
at functionC (*enclosing-call-site.js:10:3)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Flags: --enable-source-maps
22

33
'use strict';
4-
require('../common');
4+
require('../../common');
55
Error.stackTraceLimit = 2;
66

7-
require('../fixtures/source-map/tabs.js');
7+
require('../source-map/tabs.js');

β€Žtest/message/source_map_sourcemapping_url_string.js renamed to β€Žtest/fixtures/map/source_map_sourcemapping_url_string.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Flags: --enable-source-maps
22

33
'use strict';
4-
require('../common');
4+
require('../../common');
55
Error.stackTraceLimit = 2;
66

77
try {
8-
require('../fixtures/source-map/typescript-sourcemapping_url_string');
8+
require('../source-map/typescript-sourcemapping_url_string');
99
} catch (err) {
1010
setTimeout(() => {
1111
console.info(err);

β€Žtest/message/source_map_throw_catch.js renamed to β€Žtest/fixtures/map/source_map_throw_catch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Flags: --enable-source-maps
22

33
'use strict';
4-
require('../common');
4+
require('../../common');
55
Error.stackTraceLimit = 2;
66

77
try {
8-
require('../fixtures/source-map/typescript-throw');
8+
require('../source-map/typescript-throw');
99
} catch (err) {
1010
setTimeout(() => {
1111
console.info(err);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Flags: --enable-source-maps
22

33
'use strict';
4-
require('../common');
4+
require('../../common');
55
Error.stackTraceLimit = 2;
66

7-
require('../fixtures/source-map/icu');
7+
require('../source-map/icu');
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Flags: --enable-source-maps
2+
3+
'use strict';
4+
require('../../common');
5+
require('../source-map/uglify-throw');

β€Žtest/message/promise_unhandled_warn_with_error.js renamed to β€Žtest/fixtures/promise/promise_unhandled_warn_with_error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Flags: --unhandled-rejections=warn-with-error-code
22
'use strict';
33

4-
require('../common');
4+
require('../../common');
55
const assert = require('assert');
66

77
Promise.reject(new Error('alas'));
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Flags: --trace-warnings --unhandled-rejections=warn
22
'use strict';
3-
require('../common');
3+
require('../../common');
44
const p = Promise.reject(new Error('This was rejected'));
55
setImmediate(() => p.catch(() => {}));

β€Žtest/message/max_tick_depth.js renamed to β€Žtest/fixtures/tick/max_tick_depth.js

Lines changed: 1 addition & 1 deletion
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/tick/nexttick_throw.js

Lines changed: 1 addition & 1 deletion
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() {

0 commit comments

Comments
Β (0)