-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: migrate messages v8 tests from Python to JS #51534
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 } | ||
); |
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 * |
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')); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Assertion failed Symbol(hello) |
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:*:* | ||
Comment on lines
+7
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here and below. |
||
|
||
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 |
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); |
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 * |
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!'); |
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.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to get all of this out of the snapshot, so that changes to the CommonJS loader don’t break tests such as this one. You can use
Error.stackTraceLimit = 1
or similar for this (see the similar tests nearby).