diff options
Diffstat (limited to 'tests')
16 files changed, 54 insertions, 61 deletions
diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index d1d20aee1..159663233 100644 --- a/tests/integration/mod.rs +++ b/tests/integration/mod.rs @@ -41,8 +41,6 @@ mod jupyter; mod lint; #[path = "lsp_tests.rs"] mod lsp; -#[path = "node_compat_tests.rs"] -mod node_compat_tests; #[path = "node_unit_tests.rs"] mod node_unit_tests; #[path = "npm_tests.rs"] diff --git a/tests/integration/node_compat_tests.rs b/tests/integration/node_compat_tests.rs deleted file mode 100644 index 9dfd07ab4..000000000 --- a/tests/integration/node_compat_tests.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. - -use test_util as util; -use test_util::itest; -use util::env_vars_for_npm_tests; - -itest!(node_test_module { - args: "test node/test.js", - output: "node/test.out", - envs: env_vars_for_npm_tests(), - exit_code: 1, - http_server: true, -}); - -itest!(node_test_module_no_sanitizers { - args: "test -A --no-check node/test_no_sanitizers/test.js", - output: "node/test_no_sanitizers/test.out", - envs: env_vars_for_npm_tests(), - exit_code: 0, - // TODO(mmastrac): fix exit sanitizer part of test - // exit_code: 123, - http_server: true, -}); - -itest!( - node_process_beforeexit_exit_events_emitted_without_listeners { - args: "run node/process_beforeexit_exit_events.ts", - output: "node/process_beforeexit_exit_events.out", - exit_code: 0, - } -); - -itest!(web_node_events_dispatched_in_correct_order { - args: "run node/events_order.ts", - output: "node/events_order.out", - exit_code: 0, -}); diff --git a/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/__test__.jsonc b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/__test__.jsonc new file mode 100644 index 000000000..0f3b33300 --- /dev/null +++ b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run process_beforeexit_exit_events.ts", + "output": "process_beforeexit_exit_events.out", + "exitCode": 0 +} diff --git a/tests/testdata/node/process_beforeexit_exit_events.out b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/process_beforeexit_exit_events.out index 740ef6ffb..740ef6ffb 100644 --- a/tests/testdata/node/process_beforeexit_exit_events.out +++ b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/process_beforeexit_exit_events.out diff --git a/tests/testdata/node/process_beforeexit_exit_events.ts b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/process_beforeexit_exit_events.ts index a4c87f27e..a4c87f27e 100644 --- a/tests/testdata/node/process_beforeexit_exit_events.ts +++ b/tests/specs/node_compat_tests/node_process_beforeexit_exit_events_emitted_without_listeners/process_beforeexit_exit_events.ts diff --git a/tests/specs/node_compat_tests/node_test_module/__test__.jsonc b/tests/specs/node_compat_tests/node_test_module/__test__.jsonc new file mode 100644 index 000000000..ef93b6673 --- /dev/null +++ b/tests/specs/node_compat_tests/node_test_module/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "test test.js", + "output": "test.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 1 +} diff --git a/tests/testdata/node/test.js b/tests/specs/node_compat_tests/node_test_module/test.js index 0f0f9b6b6..0f0f9b6b6 100644 --- a/tests/testdata/node/test.js +++ b/tests/specs/node_compat_tests/node_test_module/test.js diff --git a/tests/testdata/node/test.out b/tests/specs/node_compat_tests/node_test_module/test.out index 2579f605d..c37fb355f 100644 --- a/tests/testdata/node/test.out +++ b/tests/specs/node_compat_tests/node_test_module/test.out @@ -1,5 +1,5 @@ [WILDCARD] -running 63 tests from ./node/test.js +running 63 tests from ./test.js sync pass todo ... ------- output ------- Warning: Not implemented: test.TestContext.todo @@ -57,7 +57,7 @@ async assertion fail ... FAILED [WILDCARD] resolve pass ... ok [WILDCARD] reject fail ... FAILED [WILDCARD] unhandled rejection - passes but warns ... -Uncaught error from ./node/test.js FAILED +Uncaught error from ./test.js FAILED unhandled rejection - passes but warns ... cancelled ([WILDCARD]) async unhandled rejection - passes but warns ... cancelled ([WILDCARD]) immediate throw - passes but warns ... cancelled ([WILDCARD]) @@ -108,32 +108,32 @@ unfinished test with unhandledRejection ... cancelled ([WILDCARD]) ERRORS -sync fail todo => ./node/test.js:20:1 +sync fail todo => ./test.js:20:1 error: Error: thrown from sync fail todo throw new Error("thrown from sync fail todo"); [WILDCARD] -sync fail todo with message => ./node/test.js:25:1 +sync fail todo with message => ./test.js:25:1 error: Error: thrown from sync fail todo with message throw new Error("thrown from sync fail todo with message"); [WILDCARD] -sync throw fail => ./node/test.js:42:1 +sync throw fail => ./test.js:42:1 error: Error: thrown from sync throw fail throw new Error("thrown from sync throw fail"); [WILDCARD] -async throw fail => ./node/test.js:53:1 +async throw fail => ./test.js:53:1 error: Error: thrown from async throw fail throw new Error("thrown from async throw fail"); [WILDCARD] -async skip fail => ./node/test.js:64:1 +async skip fail => ./test.js:64:1 error: Error: thrown from async throw fail throw new Error("thrown from async throw fail"); [WILDCARD] -async assertion fail => ./node/test.js:69:1 +async assertion fail => ./test.js:69:1 error: AssertionError: Values are not strictly equal: @@ -145,13 +145,13 @@ error: AssertionError: Values are not strictly equal: at [WILDCARD] -reject fail => ./node/test.js:78:1 +reject fail => ./test.js:78:1 error: Error: rejected from reject fail return Promise.reject(new Error("rejected from reject fail")); ^ at [WILDCARD] -./node/test.js (uncaught error) +./test.js (uncaught error) error: (in promise) Error: rejected from unhandled rejection fail Promise.reject(new Error("rejected from unhandled rejection fail")); ^ @@ -161,14 +161,14 @@ It most likely originated from a dangling promise, event/timeout handler or top- FAILURES -sync fail todo => ./node/test.js:20:1 -sync fail todo with message => ./node/test.js:25:1 -sync throw fail => ./node/test.js:42:1 -async throw fail => ./node/test.js:53:1 -async skip fail => ./node/test.js:64:1 -async assertion fail => ./node/test.js:69:1 -reject fail => ./node/test.js:78:1 -./node/test.js (uncaught error) +sync fail todo => ./test.js:20:1 +sync fail todo with message => ./test.js:25:1 +sync throw fail => ./test.js:42:1 +async throw fail => ./test.js:53:1 +async skip fail => ./test.js:64:1 +async assertion fail => ./test.js:69:1 +reject fail => ./test.js:78:1 +./test.js (uncaught error) FAILED | 9 passed (2 steps) | 51 failed | 4 ignored [WILDCARD] diff --git a/tests/specs/node_compat_tests/node_test_module_no_sanitizers/__test__.jsonc b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/__test__.jsonc new file mode 100644 index 000000000..0a9a9524b --- /dev/null +++ b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "args": "test -A --no-check test_no_sanitizers/test.js", + "output": "test_no_sanitizers/test.out", + "envs": { + "NO_COLOR": "1", + "NPM_CONFIG_REGISTRY": "http://localhost:4260/" + }, + "exitCode": 0 +} diff --git a/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/cat.ts b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/cat.ts new file mode 100644 index 000000000..62c82ebca --- /dev/null +++ b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/cat.ts @@ -0,0 +1,4 @@ +const filename = Deno.args[0]; +using file = await Deno.open(filename); + +await file.readable.pipeTo(Deno.stdout.writable); diff --git a/tests/testdata/node/test_no_sanitizers/test.js b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.js index edd558710..52d0f1325 100644 --- a/tests/testdata/node/test_no_sanitizers/test.js +++ b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.js @@ -1,12 +1,11 @@ import test from "node:test"; - test("should not complain about resource and op sanitizers", async (t) => { // resource - const _file1 = Deno.open("welcome.ts"); + const _file1 = Deno.open("test_no_sanitizers/welcome.ts"); await t.test("nested test", () => { // resource - const _file2 = Deno.open("cat.ts"); + const _file2 = Deno.open("test_no_sanitizers/cat.ts"); // op crypto.subtle.digest( diff --git a/tests/testdata/node/test_no_sanitizers/test.out b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.out index 5bd41aadf..dc5ab7cfd 100644 --- a/tests/testdata/node/test_no_sanitizers/test.out +++ b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.out @@ -1,4 +1,4 @@ -running 1 test from ./node/test_no_sanitizers/test.js +running 1 test from ./test_no_sanitizers/test.js should not complain about resource and op sanitizers ... nested test ... ok ([WILDCARD]) should not complain about resource and op sanitizers ... ok ([WILDCARD]) diff --git a/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/welcome.ts b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/welcome.ts new file mode 100644 index 000000000..f983ca89b --- /dev/null +++ b/tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/welcome.ts @@ -0,0 +1 @@ +console.log("Welcome to Deno!"); diff --git a/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/__test__.jsonc b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/__test__.jsonc new file mode 100644 index 000000000..cb5e48878 --- /dev/null +++ b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run events_order.ts", + "output": "events_order.out", + "exitCode": 0 +} diff --git a/tests/testdata/node/events_order.out b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/events_order.out index 270384d8d..270384d8d 100644 --- a/tests/testdata/node/events_order.out +++ b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/events_order.out diff --git a/tests/testdata/node/events_order.ts b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/events_order.ts index 263f46b4c..263f46b4c 100644 --- a/tests/testdata/node/events_order.ts +++ b/tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/events_order.ts |