diff --git a/tests/integration/mod.rs b/tests/integration/mod.rs index d1d20aee18..159663233f 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 9dfd07ab44..0000000000 --- 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 0000000000..0f3b33300b --- /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 similarity index 100% rename from tests/testdata/node/process_beforeexit_exit_events.out rename to 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 similarity index 100% rename from tests/testdata/node/process_beforeexit_exit_events.ts rename to 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 0000000000..ef93b66731 --- /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 similarity index 100% rename from tests/testdata/node/test.js rename to 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 similarity index 88% rename from tests/testdata/node/test.out rename to tests/specs/node_compat_tests/node_test_module/test.out index 2579f605d2..c37fb355f4 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 0000000000..0a9a9524b4 --- /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 0000000000..62c82ebca0 --- /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 similarity index 83% rename from tests/testdata/node/test_no_sanitizers/test.js rename to tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.js index edd5587107..52d0f13258 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 similarity index 79% rename from tests/testdata/node/test_no_sanitizers/test.out rename to tests/specs/node_compat_tests/node_test_module_no_sanitizers/test_no_sanitizers/test.out index 5bd41aadfd..dc5ab7cfd1 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 0000000000..f983ca89ba --- /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 0000000000..cb5e48878b --- /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 similarity index 100% rename from tests/testdata/node/events_order.out rename to 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 similarity index 100% rename from tests/testdata/node/events_order.ts rename to tests/specs/node_compat_tests/web_node_events_dispatched_in_correct_order/events_order.ts diff --git a/tools/lint.js b/tools/lint.js index 54c0de034a..bb4781e279 100755 --- a/tools/lint.js +++ b/tools/lint.js @@ -214,7 +214,7 @@ async function ensureNoNewITests() { "lint_tests.rs": 18, // Read the comment above. Please don't increase these numbers! "lsp_tests.rs": 0, - "node_compat_tests.rs": 4, + "node_compat_tests.rs": 0, "node_unit_tests.rs": 2, "npm_tests.rs": 92, "pm_tests.rs": 0, @@ -227,7 +227,7 @@ async function ensureNoNewITests() { "upgrade_tests.rs": 0, "vendor_tests.rs": 1, "watcher_tests.rs": 0, - "worker_tests.rs": 18, + "worker_tests.rs": 0, }; const integrationDir = join(ROOT_PATH, "tests", "integration"); for await (const entry of Deno.readDir(integrationDir)) {