Skip to content

Commit

Permalink
chore: bump deno_core and update tests (denoland#21467)
Browse files Browse the repository at this point in the history
Landing changes required for
denoland/deno_core#359

We needed to update 99_main.js and a whole load of tests.

API changes:

- setPromiseRejectCallback becomes setUnhandledPromiseRejectionHandler.
The function is now called from eventLoopTick.
- The promiseRejectMacrotaskCallback no longer exists, as this is
automatically handled in eventLoopTick.
- ops.op_dispatch_exception now takes a second parameter: in_promise.
The preferred way to call this op is now reportUnhandledException or
reportUnhandledPromiseRejection.
  • Loading branch information
mmastrac committed Dec 7, 2023
1 parent 68d356e commit 9314928
Show file tree
Hide file tree
Showing 59 changed files with 105 additions and 191 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repository = "https://github.com/denoland/deno"

[workspace.dependencies]
deno_ast = { version = "0.31.6", features = ["transpiling"] }
deno_core = { version = "0.234.0" }
deno_core = { version = "0.235.0" }

deno_runtime = { version = "0.135.0", path = "./runtime" }
napi_sym = { version = "0.57.0", path = "./cli/napi/sym" }
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/integration/compile_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn standalone_error() {
let stderr = output.stderr();
// On Windows, we cannot assert the file path (because '\').
// Instead we just check for relevant output.
assert_contains!(stderr, "error: Uncaught Error: boom!");
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
assert_contains!(stderr, "throw new Error(\"boom!\");");
assert_contains!(stderr, "\n at boom (file:https://");
assert_contains!(stderr, "standalone_error.ts:2:9");
Expand Down Expand Up @@ -145,7 +145,7 @@ fn standalone_error_module_with_imports() {
let stderr = output.stderr();
// On Windows, we cannot assert the file path (because '\').
// Instead we just check for relevant output.
assert_contains!(stderr, "error: Uncaught Error: boom!");
assert_contains!(stderr, "error: Uncaught (in promise) Error: boom!");
assert_contains!(stderr, "throw new Error(\"boom!\");");
assert_contains!(stderr, "\n at file:https://");
assert_contains!(stderr, "standalone_error_module_with_imports_2.ts:2:7");
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/integration/repl_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ fn repl_reject() {
console.write_line(r#"Promise.reject(new Error("foo"));"#);
console.expect("Promise {");
console.expect(" <rejected> Error: foo");
console.expect("Uncaught (in promise) Error: foo");
console.expect("Uncaught Error: foo");
console.expect(" at <anonymous>");
console.write_line("console.log(2);");
console.expect("2");
Expand Down Expand Up @@ -857,7 +857,7 @@ fn repl_error_undefined() {
console.expect("Uncaught undefined");
console.write_line(r#"Promise.reject();"#);
console.expect("Promise { <rejected> undefined }");
console.expect("Uncaught (in promise) undefined");
console.expect("Uncaught undefined");
console.write_line(r#"reportError(undefined);"#);
console.expect("undefined");
console.expect("Uncaught undefined");
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/integration/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3926,7 +3926,7 @@ async fn test_resolve_dns() {
let out = String::from_utf8_lossy(&output.stdout);
assert!(!output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#));
assert!(err.contains(r#"error: Uncaught (in promise) PermissionDenied: Requires net access to "127.0.0.1:4553""#));
assert!(out.is_empty());
}

Expand All @@ -3947,7 +3947,7 @@ async fn test_resolve_dns() {
let out = String::from_utf8_lossy(&output.stdout);
assert!(!output.status.success());
assert!(err.starts_with("Check file"));
assert!(err.contains(r#"error: Uncaught PermissionDenied: Requires net access to "127.0.0.1:4553""#));
assert!(err.contains(r#"error: Uncaught (in promise) PermissionDenied: Requires net access to "127.0.0.1:4553""#));
assert!(out.is_empty());
}

Expand Down Expand Up @@ -4067,7 +4067,7 @@ fn broken_stdout() {

assert!(!output.status.success());
let stderr = std::str::from_utf8(output.stderr.as_ref()).unwrap().trim();
assert!(stderr.contains("Uncaught BrokenPipe"));
assert!(stderr.contains("Uncaught (in promise) BrokenPipe"));
assert!(!stderr.contains("panic"));
}

Expand Down
6 changes: 5 additions & 1 deletion cli/tests/integration/watcher_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,11 @@ async fn run_watch_error_messages() {
let (_, mut stderr_lines) = child_lines(&mut child);

wait_contains("Process started", &mut stderr_lines).await;
wait_contains("error: Uncaught SyntaxError: outer", &mut stderr_lines).await;
wait_contains(
"error: Uncaught (in promise) SyntaxError: outer",
&mut stderr_lines,
)
.await;
wait_contains("Caused by: TypeError: inner", &mut stderr_lines).await;
wait_contains("Process failed", &mut stderr_lines).await;

Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/bench/no_check.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: TypeError: Cannot read properties of undefined (reading 'fn')
error: (in promise) TypeError: Cannot read properties of undefined (reading 'fn')
Deno.bench();
^
at [WILDCARD]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/error_cause_recursive_aggregate.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught AggregateError
error: Uncaught (in promise) AggregateError
Error: bar <ref *1>
at file:https:///[WILDCARD]/error_cause_recursive_aggregate.ts:2:13
Caused by: Error: foo
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/error_cause_recursive_tail.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error: baz
error: Uncaught (in promise) Error: baz
const baz = new Error("baz", { cause: bar });
^
at file:https:///[WILDCARD]/error_cause_recursive_tail.ts:3:13
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/node/require_esm_error/main.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
error: Uncaught Error: require() of ES Module [WILDCARD]esm.js from [WILDCARD]main.ts not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
error: Uncaught (in promise) Error: require() of ES Module [WILDCARD]esm.js from [WILDCARD]main.ts not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
at [WILDCARD]
at file:https:///[WILDCARD]/require_esm_error/main.ts:5:1
2 changes: 1 addition & 1 deletion cli/tests/testdata/npm/cjs_require_esm_error/main.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Uncaught Error: require() of ES Module [WILDCARD]my_esm_module.js from [WILDCARD]index.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
error: Uncaught (in promise) Error: require() of ES Module [WILDCARD]my_esm_module.js from [WILDCARD]index.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/npm/cjs_require_esm_mjs_error/main.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Uncaught Error: require() of ES Module [WILDCARD]esm_mjs.mjs from [WILDCARD]require_mjs.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
error: Uncaught (in promise) Error: require() of ES Module [WILDCARD]esm_mjs.mjs from [WILDCARD]require_mjs.js not supported. Instead change the require to a dynamic import() which is available in all CommonJS modules.
[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/npm/cjs_this_in_exports/main.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1
1
error: Uncaught TypeError: this.otherMethod is not a function
error: Uncaught (in promise) TypeError: this.otherMethod is not a function
at getValue (file:https://[WILDCARD]/@denotest/cjs-this-in-exports/1.0.0/index.js:3:17)
at file:https://[WILDCARD]/testdata/npm/cjs_this_in_exports/main.js:11:1
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/059_fs_relative_path_perm.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag
[WILDCARD]error: Uncaught (in promise) PermissionDenied: Requires read access to "non-existent", run again with the --allow-read flag
Deno.readFileSync("non-existent");
^
at [WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/077_fetch_empty.ts.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[WILDCARD]error: Uncaught TypeError: Invalid URL: ''
[WILDCARD]error: Uncaught (in promise) TypeError: Invalid URL: ''
[WILDCARD]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[WILDCARD]error: Uncaught Error: foo
[WILDCARD]error: Uncaught (in promise) Error: foo
[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/aggregate_error.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AggregateError: Multiple errors.
at [WILDCARD]/aggregate_error.ts:3:3
at [WILDCARD]/aggregate_error.ts:1:24

error: Uncaught AggregateError: Multiple errors.
error: Uncaught (in promise) AggregateError: Multiple errors.
Error: Error message 1.
at [WILDCARD]/aggregate_error.ts:2:3
Error: Error message 2.
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/complex_error.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ AggregateError: foo1
Caused by AggregateError: foo2
at [WILDCARD]/complex_error.ts:8:12

error: Uncaught AggregateError: foo1
error: Uncaught (in promise) AggregateError: foo1
AggregateError
Error: qux1
at [WILDCARD]/complex_error.ts:3:25
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/dom_exception_formatting.ts.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[WILDCARD]error: Uncaught SyntaxError: foo
[WILDCARD]error: Uncaught (in promise) SyntaxError: foo
[WILDCARD]
at file:https:///[WILDCARD]/dom_exception_formatting.ts:[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_001.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught Error: bad
[WILDCARD]error: Uncaught (in promise) Error: bad
throw Error("bad");
^
at foo ([WILDCARD]/error_001.ts:2:9)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_002.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught Error: exception from mod1
[WILDCARD]error: Uncaught (in promise) Error: exception from mod1
throw Error("exception from mod1");
^
at throwsError ([WILDCARD]/subdir/mod1.ts:16:9)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_007_any.ts.out
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[WILDCARD]error: Uncaught { foo: "bar" }
[WILDCARD]error: Uncaught (in promise) { foo: "bar" }
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_008_checkjs.js.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught ReferenceError: consol is not defined
[WILDCARD]error: Uncaught (in promise) ReferenceError: consol is not defined
consol.log("hello world!");
^
at [WILDCARD]/error_008_checkjs.js:2:1
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_009_extensions_error.js.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught TypeError: Failed to construct 'Event': 1 argument required, but only 0 present.
[WILDCARD]error: Uncaught (in promise) TypeError: Failed to construct 'Event': 1 argument required, but only 0 present.
new Event();
^
at [WILDCARD]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Uncaught TypeError: Cannot read properties of undefined (reading 'a')
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'a')
at file:https:///[WILDCARD]/error_018_hide_long_source_js.js:3:206
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_019_stack_function.ts.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[WILDCARD]Error: function
at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD])
at [WILDCARD]/error_019_stack_function.ts:[WILDCARD]
error: Uncaught Error: function
error: Uncaught (in promise) Error: function
throw new Error("function");
^
at foo ([WILDCARD]/error_019_stack_function.ts:[WILDCARD])
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_020_stack_constructor.ts.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[WILDCARD]Error: constructor
at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD])
at [WILDCARD]/error_020_stack_constructor.ts:[WILDCARD]
error: Uncaught Error: constructor
error: Uncaught (in promise) Error: constructor
throw new Error("constructor");
^
at new A ([WILDCARD]/error_020_stack_constructor.ts:[WILDCARD])
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_021_stack_method.ts.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[WILDCARD]Error: method
at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD])
at [WILDCARD]/error_021_stack_method.ts:[WILDCARD]
error: Uncaught Error: method
error: Uncaught (in promise) Error: method
throw new Error("method");
^
at A.m ([WILDCARD]/error_021_stack_method.ts:[WILDCARD])
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_022_stack_custom_error.ts.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[WILDCARD]CustomError: custom error
at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD]
error: Uncaught CustomError: custom error
error: Uncaught (in promise) CustomError: custom error
const error = new CustomError();
^
at [WILDCARD]/error_022_stack_custom_error.ts:[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_023_stack_async.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
at [WILDCARD]/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]/error_023_stack_async.ts:[WILDCARD]
error: Uncaught Error: async
error: Uncaught (in promise) Error: async
throw new Error("async");
^
at [WILDCARD]/error_023_stack_async.ts:[WILDCARD]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_024_stack_promise_all.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD]
at async Promise.all (index 1)
at async [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD]
error: Uncaught Error: Promise.all()
error: Uncaught (in promise) Error: Promise.all()
throw new Error("Promise.all()");
^
at [WILDCARD]/error_024_stack_promise_all.ts:[WILDCARD]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_025_tab_indent.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[WILDCARD]error: Uncaught Error: bad
[WILDCARD]error: Uncaught (in promise) Error: bad
throw Error("bad");
^
at foo ([WILDCARD]/error_025_tab_indent:2:8)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[WILDCARD]
error: Uncaught Error: bad
error: Uncaught (in promise) Error: bad
throw Error("bad");
^
at foo (http:https://localhost:4545/run/error_001.ts:2:9)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_cause.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error: foo
error: Uncaught (in promise) Error: foo
throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) });
^
at a (file:https:///[WILDCARD]/error_cause.ts:3:9)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_cause_recursive.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error: bar <ref *1>
error: Uncaught (in promise) Error: bar <ref *1>
const y = new Error("bar", { cause: x });
^
at file:https:///[WILDCARD]/error_cause_recursive.ts:2:11
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_name_non_string.js.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error
error: Uncaught (in promise) Error
throw new ErrorNameNonString();
^
at file:https:///[WILDCARD]/error_name_non_string.js:[WILDCARD]
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/error_with_errors_prop.js.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Error: Error with errors prop.
]
}

error: Uncaught Error: Error with errors prop.
error: Uncaught (in promise) Error: Error with errors prop.
const error = new Error("Error with errors prop.");
^
at [WILDCARD]/error_with_errors_prop.js:1:15
10 changes: 2 additions & 8 deletions cli/tests/testdata/run/extension_dynamic_import.ts.out
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
error: Uncaught (in promise) TypeError: Unsupported scheme "ext" for module "ext:runtime/01_errors.js". Supported schemes: [
"data",
"blob",
"file",
"http",
"https",
]
error: Uncaught (in promise) TypeError: Importing ext: modules is only allowed from ext: and node: modules. Tried to import ext:runtime/01_errors.js from [WILDCARD]/testdata/run/extension_dynamic_import.ts
await import("ext:runtime/01_errors.js");
^
at async [WILDCARD]/extension_dynamic_import.ts:1:1
at async [WILDCARD]/run/extension_dynamic_import.ts:1:1
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/import_data_url_error_stack.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error: Hello 2
error: Uncaught (in promise) Error: Hello 2
throw new Error(`Hello ${A.C}`);
^
at a (data:application/typescript;base64,ZW51bSBBIHsKICBBLAog......JHtBLkN9YCk7CiB9CiA=:8:10)
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/inline_js_source_map_2.js.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Uncaught Error: Hello world!
error: Uncaught (in promise) Error: Hello world!
at http:https://localhost:4545/run/inline_js_source_map_2.ts:6:7
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
error: Uncaught Error: Hello world!
error: Uncaught (in promise) Error: Hello world!
at http:https://localhost:4545/run/inline_js_source_map_2.ts:6:7
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught Error: Hello world!
error: Uncaught (in promise) Error: Hello world!
// throw new Error("Hello world!" as string);
^
at http:https://localhost:4545/run/inline_js_source_map.ts:6:7
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/nested_error/main.ts.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: Uncaught {
error: Uncaught (in promise) {
foo: Error
at file:https:///[WILDCARD]/main.ts:2:8
}
2 changes: 1 addition & 1 deletion cli/tests/testdata/run/node_env_var_allowlist.ts.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ok
[WILDCARD]error: Uncaught PermissionDenied: Requires env access to "NOT_NODE_DEBUG", run again with the --allow-env flag
[WILDCARD]error: Uncaught (in promise) PermissionDenied: Requires env access to "NOT_NODE_DEBUG", run again with the --allow-env flag
Deno.env.get("NOT_NODE_DEBUG");
^
at [WILDCARD]
1 change: 1 addition & 0 deletions cli/tests/testdata/run/with_config/auto_discovery_log.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DEBUG RS - [WILDCARD] - Config file found at '[WILDCARD]deno.jsonc'
[WILDCARD]
ok
[WILDCARD]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[WILDCARD]package.json auto-discovery is disabled
[WILDCARD]
success
[WILDCARD]
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ this
is
a
test
[WILDCARD]
4 changes: 2 additions & 2 deletions cli/tests/testdata/test/no_check.out
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Uncaught error from ./test/no_check.ts FAILED
ERRORS

./test/no_check.ts (uncaught error)
error: TypeError: Cannot read properties of undefined (reading 'fn')
error: (in promise) TypeError: Cannot read properties of undefined (reading 'fn')
Deno.test();
^
at [WILDCARD]/test/no_check.ts:1:6
at [WILDCARD]
This error was not caught from a test and caused the test runner to fail on the referenced module.
It most likely originated from a dangling promise, event/timeout handler or top-level code.

Expand Down
Loading

0 comments on commit 9314928

Please sign in to comment.