forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate messages v8 tests from Python to JS
Migrated messages v8 tests from Python to JavaScript. This change is part of an effort to enhance maintainability and consistency in the test suite. All relevant test files and dependencies have been updated accordingly. Refs: nodejs#47707
- Loading branch information
1 parent
880c90c
commit 6ec8d3d
Showing
17 changed files
with
195 additions
and
171 deletions.
There are no files selected for viewing
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,11 @@ | ||
'use strict'; | ||
|
||
require('../../common'); | ||
const assert = require('assert').strict; | ||
|
||
assert.throws( | ||
() => { | ||
throw new Error('foo'); | ||
}, | ||
{ bar: true } | ||
); |
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,36 @@ | ||
node:assert:* | ||
throw err; | ||
^ | ||
|
||
AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: | ||
+ actual - expected | ||
|
||
+ Comparison {} | ||
- Comparison { | ||
- bar: true | ||
- } | ||
at Object.<anonymous> (*assert_throws_stack.js:*:*) | ||
at Module._compile (node:internal*modules*cjs*loader:*:*) | ||
at Module._extensions..js (node:internal*modules*cjs*loader:*:*) | ||
at Module.load (node:internal*modules*cjs*loader:*:*) | ||
at Module._load (node:internal*modules*cjs*loader:*:*) | ||
at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:*:*) | ||
at node:internal*main*run_main_module:*:* { | ||
generatedMessage: true, | ||
code: 'ERR_ASSERTION', | ||
actual: Error: foo | ||
at assert.throws.bar (*assert_throws_stack.js:*:*) | ||
at getActual (node:assert:*:*) | ||
at Function.throws (node:assert:*:*) | ||
at Object.<anonymous> (*assert_throws_stack.js:*:*) | ||
at Module._compile (node:internal*modules*cjs*loader:*:*) | ||
at Module._extensions..js (node:internal*modules*cjs*loader:*:*) | ||
at Module.load (node:internal*modules*cjs*loader:*:*) | ||
at Module._load (node:internal*modules*cjs*loader:*:*) | ||
at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:*:*) | ||
at node:internal*main*run_main_module:*:*, | ||
expected: { bar: true }, | ||
operator: 'throws' | ||
} | ||
|
||
Node.js * |
2 changes: 1 addition & 1 deletion
2
test/message/console_assert.js → test/fixtures/errors/console_assert.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 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
require('../../common'); | ||
|
||
console.assert(false, Symbol('hello')); |
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,15 @@ | ||
node:internal*console*constructor:* | ||
args[0] = `Assertion failed${args.length === 0 ? '' : `: ${args[0]}`}`; | ||
^ | ||
|
||
TypeError: Cannot convert a Symbol value to a string | ||
at console.assert (node:internal*console*constructor:*:*) | ||
at Object.<anonymous> (*console_assert.js:*:*) | ||
at Module._compile (node:internal*modules*cjs*loader:*:*) | ||
at Module._extensions..js (node:internal*modules*cjs*loader:*:*) | ||
at Module.load (node:internal*modules*cjs*loader:*:*) | ||
at Module._load (node:internal*modules*cjs*loader:*:*) | ||
at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:*:*) | ||
at node:internal*main*run_main_module:*:* | ||
|
||
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,76 @@ | ||
[eval] | ||
[eval]:* | ||
with(this){__filename} | ||
^^^^ | ||
|
||
SyntaxError: Strict mode code may not include a with statement | ||
at makeContextifyScript (node:internal*vm:*:*) | ||
at node:internal*process*execution:*:* | ||
at [eval]-wrapper:*:* | ||
at runScript (node:internal*process*execution:*:*) | ||
at evalScript (node:internal*process*execution:*:*) | ||
at node:internal*main*eval_string:*:* | ||
|
||
Node.js * | ||
42 | ||
42 | ||
[eval]:* | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
at [eval]:*:* | ||
at runScriptInThisContext (node:internal*vm:*:*) | ||
at node:internal*process*execution:*:* | ||
at [eval]-wrapper:*:* | ||
at runScript (node:internal*process*execution:*:*) | ||
at evalScript (node:internal*process*execution:*:*) | ||
at node:internal*main*eval_string:*:* | ||
|
||
Node.js * | ||
[eval]:* | ||
throw new Error("hello") | ||
^ | ||
|
||
Error: hello | ||
at [eval]:*:* | ||
at runScriptInThisContext (node:internal*vm:*:*) | ||
at node:internal*process*execution:*:* | ||
at [eval]-wrapper:*:* | ||
at runScript (node:internal*process*execution:*:*) | ||
at evalScript (node:internal*process*execution:*:*) | ||
at node:internal*main*eval_string:*:* | ||
|
||
Node.js * | ||
100 | ||
[eval]:* | ||
var x = 100; y = x; | ||
^ | ||
|
||
ReferenceError: y is not defined | ||
at [eval]:*:* | ||
at runScriptInThisContext (node:internal*vm:*:*) | ||
at node:internal*process*execution:*:* | ||
at [eval]-wrapper:*:* | ||
at runScript (node:internal*process*execution:*:*) | ||
at evalScript (node:internal*process*execution:*:*) | ||
at node:internal*main*eval_string:*:* | ||
|
||
Node.js * | ||
|
||
[eval]:* | ||
var ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
|
||
[eval]:* | ||
var ______________________________________________; throw 10 | ||
^ | ||
10 | ||
(Use `node --trace-uncaught ...` to show where the exception was thrown) | ||
|
||
Node.js * | ||
done |
2 changes: 1 addition & 1 deletion
2
test/message/internal_assert.js → test/fixtures/errors/internal_assert.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 @@ | ||
'use strict'; | ||
|
||
// Flags: --expose-internals | ||
require('../common'); | ||
require('../../common'); | ||
|
||
const assert = require('internal/assert'); | ||
assert(false); |
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,19 @@ | ||
node:internal*assert:* | ||
throw new ERR_INTERNAL_ASSERTION(message); | ||
^ | ||
|
||
Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals. | ||
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues | ||
|
||
at assert (node:internal*assert:*:*) | ||
at Object.<anonymous> (*internal_assert.js:*:*) | ||
at Module._compile (node:internal*modules*cjs*loader:*:*) | ||
at Module._extensions..js (node:internal*modules*cjs*loader:*:*) | ||
at Module.load (node:internal*modules*cjs*loader:*:*) | ||
at Module._load (node:internal*modules*cjs*loader:*:*) | ||
at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:*:*) | ||
at node:internal*main*run_main_module:*:* { | ||
code: 'ERR_INTERNAL_ASSERTION' | ||
} | ||
|
||
Node.js * |
2 changes: 1 addition & 1 deletion
2
test/message/internal_assert_fail.js → test/fixtures/errors/internal_assert_fail.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 @@ | ||
'use strict'; | ||
|
||
// Flags: --expose-internals | ||
require('../common'); | ||
require('../../common'); | ||
|
||
const assert = require('internal/assert'); | ||
assert.fail('Unreachable!'); |
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,20 @@ | ||
node:internal*assert:* | ||
throw new ERR_INTERNAL_ASSERTION(message); | ||
^ | ||
|
||
Error [ERR_INTERNAL_ASSERTION]: Unreachable! | ||
This is caused by either a bug in Node.js or incorrect usage of Node.js internals. | ||
Please open an issue with this stack trace at https:*github.com*nodejs*node*issues | ||
|
||
at Function.fail (node:internal*assert:*:*) | ||
at Object.<anonymous> (*internal_assert_fail.js:*:*) | ||
at Module._compile (node:internal*modules*cjs*loader:*:*) | ||
at Module._extensions..js (node:internal*modules*cjs*loader:*:*) | ||
at Module.load (node:internal*modules*cjs*loader:*:*) | ||
at Module._load (node:internal*modules*cjs*loader:*:*) | ||
at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:*:*) | ||
at node:internal*main*run_main_module:*:* { | ||
code: 'ERR_INTERNAL_ASSERTION' | ||
} | ||
|
||
Node.js * |
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.
Oops, something went wrong.