-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate message error tests from Python to JS
Migrate the remaining error tests in the `test/message` folder from Python to JS. Fixes: #47707 PR-URL: #49721 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
- Loading branch information
Yiyun Lei
authored
Sep 21, 2023
1 parent
85172c3
commit 853f572
Showing
29 changed files
with
112 additions
and
101 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
test/message/core_line_numbers.js → test/fixtures/errors/core_line_numbers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/message/if-error-has-good-stack.js → ...ixtures/errors/if-error-has-good-stack.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sage/promise_unhandled_warn_with_error.js → ...rors/promise_unhandled_warn_with_error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
test/fixtures/errors/promise_unhandled_warn_with_error.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(node:*) UnhandledPromiseRejectionWarning: Error: alas | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
(Use `node --trace-warnings ...` to show where the warning was created) | ||
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*nodejs.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1) |
2 changes: 1 addition & 1 deletion
2
.../test-no-extra-info-on-fatal-exception.js → .../test-no-extra-info-on-fatal-exception.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Flags: --no-extra-info-on-fatal-exception | ||
|
||
'use strict'; | ||
require('../common'); | ||
require('../../common'); | ||
Error.stackTraceLimit = 1; | ||
|
||
throw new Error('foo'); |
6 changes: 6 additions & 0 deletions
6
test/fixtures/errors/test-no-extra-info-on-fatal-exception.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*test-no-extra-info-on-fatal-exception.js:7 | ||
throw new Error('foo'); | ||
^ | ||
|
||
Error: foo | ||
at Object.<anonymous> (*test-no-extra-info-on-fatal-exception.js:7:7) |
2 changes: 1 addition & 1 deletion
2
.../message/throw_error_with_getter_throw.js → ...s/errors/throw_error_with_getter_throw.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
*throw_error_with_getter_throw.js:* | ||
throw { * eslint-disable-line no-throw-literal | ||
^ | ||
[object Object] | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
*throw_null.js:* | ||
throw null; | ||
^ | ||
null | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
*throw_undefined.js:* | ||
throw undefined; | ||
^ | ||
undefined | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*timeout_throw.js:* | ||
undefined_reference_error_maker; | ||
^ | ||
|
||
ReferenceError: undefined_reference_error_maker is not defined | ||
at Timeout._onTimeout (*timeout_throw.js:*:*) | ||
at listOnTimeout (node:internal*timers:*:*) | ||
at process.processTimers (node:internal*timers:*:*) | ||
|
||
Node.js * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
test/fixtures/errors/undefined_reference_in_new_context.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
before | ||
evalmachine.<anonymous>:* | ||
Error.stackTraceLimit = 5; foo.bar = 5; | ||
^ | ||
|
||
ReferenceError: foo is not defined | ||
at evalmachine.<anonymous>:*:* | ||
at Script.runInContext (node:vm:*:*) | ||
at Script.runInNewContext (node:vm:*:*) | ||
at Object.runInNewContext (node:vm:*:*) | ||
at Object.<anonymous> (*undefined_reference_in_new_context.js:*:*) | ||
|
||
Node.js * |
2 changes: 1 addition & 1 deletion
2
...ssage/unhandled_promise_trace_warnings.js → ...rrors/unhandled_promise_trace_warnings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Flags: --trace-warnings --unhandled-rejections=warn | ||
'use strict'; | ||
require('../common'); | ||
require('../../common'); | ||
const p = Promise.reject(new Error('This was rejected')); | ||
setImmediate(() => p.catch(() => {})); |
26 changes: 26 additions & 0 deletions
26
test/fixtures/errors/unhandled_promise_trace_warnings.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(node:*) UnhandledPromiseRejectionWarning: Error: This was rejected | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
(node:*) Error: This was rejected | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
(node:*) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) | ||
at * | ||
at * | ||
at Promise.then (<anonymous>) | ||
at Promise.catch (<anonymous>) | ||
at * | ||
at * |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters