diff --git a/Cargo.lock b/Cargo.lock index 5b26beca86..f97bbf340d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -644,7 +644,7 @@ dependencies = [ "pretty_assertions", "serde", "serde_repr", - "test_util", + "test_server", "tokio", "tokio-util", "tower-lsp", @@ -1090,7 +1090,7 @@ dependencies = [ "shell-escape", "tar", "tempfile", - "test_util", + "test_server", "text-size", "text_lines", "thiserror", @@ -1758,7 +1758,7 @@ dependencies = [ "rustyline", "serde", "signal-hook-registry", - "test_util", + "test_server", "tokio", "tokio-metrics", "uuid", @@ -6378,7 +6378,7 @@ name = "test_ffi" version = "0.1.0" dependencies = [ "pretty_assertions", - "test_util", + "test_server", ] [[package]] @@ -6387,11 +6387,11 @@ version = "0.1.0" dependencies = [ "napi-build", "napi-sys", - "test_util", + "test_server", ] [[package]] -name = "test_util" +name = "test_server" version = "0.1.0" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 00bbd725d4..113880a0cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,10 +28,10 @@ members = [ "ext/websocket", "ext/webstorage", "runtime", - "test_util", "tests", "tests/ffi", "tests/napi", + "tests/util/server", ] exclude = ["tests/util/std/hash/_wasm"] @@ -51,7 +51,7 @@ deno_media_type = { version = "0.1.1", features = ["module_specifier"] } deno_runtime = { version = "0.146.0", path = "./runtime" } deno_terminal = "0.1.1" napi_sym = { version = "0.68.0", path = "./cli/napi/sym" } -test_util = { path = "./test_util" } +test_util = { package = "test_server", path = "./tests/util/server" } denokv_proto = "0.5.0" denokv_remote = "0.5.0" diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index f3f9746904..56755b518c 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -1001,8 +1001,8 @@ mod tests { // be used again after the snapshot is taken. We should figure out a mechanism // to allow removing some of the ops before taking a snapshot. #[ignore] - #[test] - fn test_compiler_snapshot() { + #[tokio::test] + async fn test_compiler_snapshot() { let mut js_runtime = JsRuntime::new(RuntimeOptions { startup_snapshot: Some(compiler_snapshot()), ..Default::default() @@ -1027,8 +1027,8 @@ mod tests { assert_eq!(actual, "11905938177474799758"); } - #[test] - fn test_hash_url() { + #[tokio::test] + async fn test_hash_url() { let specifier = deno_core::resolve_url( "data:application/javascript,console.log(\"Hello%20Deno\");", ) diff --git a/tests/testdata/npm/README.md b/tests/testdata/npm/README.md index ba3f5f7717..bb4a3bad3d 100644 --- a/tests/testdata/npm/README.md +++ b/tests/testdata/npm/README.md @@ -4,7 +4,7 @@ This folder contains test data for npm specifiers. ## Registry -The registry is served by the test server (server in test_util) at +The registry is served by the test server (server in `tests/util/server`) at http://localhost:4545/npm/registry/ via the `./registry` folder. ### Updating with real npm packages diff --git a/test_util/Cargo.toml b/tests/util/server/Cargo.toml similarity index 98% rename from test_util/Cargo.toml rename to tests/util/server/Cargo.toml index e46c308b6e..fbec0e1aad 100644 --- a/test_util/Cargo.toml +++ b/tests/util/server/Cargo.toml @@ -1,7 +1,7 @@ # Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. [package] -name = "test_util" +name = "test_server" version = "0.1.0" authors.workspace = true edition.workspace = true diff --git a/test_util/src/assertions.rs b/tests/util/server/src/assertions.rs similarity index 100% rename from test_util/src/assertions.rs rename to tests/util/server/src/assertions.rs diff --git a/test_util/src/builders.rs b/tests/util/server/src/builders.rs similarity index 100% rename from test_util/src/builders.rs rename to tests/util/server/src/builders.rs diff --git a/test_util/src/factory.rs b/tests/util/server/src/factory.rs similarity index 100% rename from test_util/src/factory.rs rename to tests/util/server/src/factory.rs diff --git a/test_util/src/fs.rs b/tests/util/server/src/fs.rs similarity index 100% rename from test_util/src/fs.rs rename to tests/util/server/src/fs.rs diff --git a/test_util/src/https.rs b/tests/util/server/src/https.rs similarity index 100% rename from test_util/src/https.rs rename to tests/util/server/src/https.rs diff --git a/test_util/src/lib.rs b/tests/util/server/src/lib.rs similarity index 99% rename from test_util/src/lib.rs rename to tests/util/server/src/lib.rs index e4549154d5..65dfe61ec5 100644 --- a/test_util/src/lib.rs +++ b/tests/util/server/src/lib.rs @@ -67,6 +67,10 @@ pub fn env_vars_for_jsr_tests() -> Vec<(String, String)> { pub fn root_path() -> PathRef { PathRef::new( PathBuf::from(concat!(env!("CARGO_MANIFEST_DIR"))) + .parent() + .unwrap() + .parent() + .unwrap() .parent() .unwrap(), ) diff --git a/test_util/src/lsp.rs b/tests/util/server/src/lsp.rs similarity index 100% rename from test_util/src/lsp.rs rename to tests/util/server/src/lsp.rs diff --git a/test_util/src/macros.rs b/tests/util/server/src/macros.rs similarity index 100% rename from test_util/src/macros.rs rename to tests/util/server/src/macros.rs diff --git a/test_util/src/npm.rs b/tests/util/server/src/npm.rs similarity index 100% rename from test_util/src/npm.rs rename to tests/util/server/src/npm.rs diff --git a/test_util/src/pty.rs b/tests/util/server/src/pty.rs similarity index 100% rename from test_util/src/pty.rs rename to tests/util/server/src/pty.rs diff --git a/test_util/src/servers/grpc.rs b/tests/util/server/src/servers/grpc.rs similarity index 100% rename from test_util/src/servers/grpc.rs rename to tests/util/server/src/servers/grpc.rs diff --git a/test_util/src/servers/hyper_utils.rs b/tests/util/server/src/servers/hyper_utils.rs similarity index 100% rename from test_util/src/servers/hyper_utils.rs rename to tests/util/server/src/servers/hyper_utils.rs diff --git a/test_util/src/servers/mod.rs b/tests/util/server/src/servers/mod.rs similarity index 100% rename from test_util/src/servers/mod.rs rename to tests/util/server/src/servers/mod.rs diff --git a/test_util/src/servers/registry.rs b/tests/util/server/src/servers/registry.rs similarity index 100% rename from test_util/src/servers/registry.rs rename to tests/util/server/src/servers/registry.rs diff --git a/test_util/src/servers/ws.rs b/tests/util/server/src/servers/ws.rs similarity index 100% rename from test_util/src/servers/ws.rs rename to tests/util/server/src/servers/ws.rs diff --git a/test_util/src/spawn.rs b/tests/util/server/src/spawn.rs similarity index 100% rename from test_util/src/spawn.rs rename to tests/util/server/src/spawn.rs diff --git a/test_util/src/test_server.rs b/tests/util/server/src/test_server.rs similarity index 67% rename from test_util/src/test_server.rs rename to tests/util/server/src/test_server.rs index 6fc86f415c..b0f74d606f 100644 --- a/test_util/src/test_server.rs +++ b/tests/util/server/src/test_server.rs @@ -1,5 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. fn main() { - test_util::servers::run_all_servers(); + test_server::servers::run_all_servers(); } diff --git a/test_util/src/testdata/strace_summary.out b/tests/util/server/src/testdata/strace_summary.out similarity index 100% rename from test_util/src/testdata/strace_summary.out rename to tests/util/server/src/testdata/strace_summary.out diff --git a/test_util/src/testdata/strace_summary2.out b/tests/util/server/src/testdata/strace_summary2.out similarity index 100% rename from test_util/src/testdata/strace_summary2.out rename to tests/util/server/src/testdata/strace_summary2.out diff --git a/test_util/src/testdata/strace_summary3.out b/tests/util/server/src/testdata/strace_summary3.out similarity index 100% rename from test_util/src/testdata/strace_summary3.out rename to tests/util/server/src/testdata/strace_summary3.out diff --git a/test_util/src/testdata/time.out b/tests/util/server/src/testdata/time.out similarity index 100% rename from test_util/src/testdata/time.out rename to tests/util/server/src/testdata/time.out diff --git a/test_util/src/testdata/wrk1.txt b/tests/util/server/src/testdata/wrk1.txt similarity index 100% rename from test_util/src/testdata/wrk1.txt rename to tests/util/server/src/testdata/wrk1.txt diff --git a/test_util/src/testdata/wrk2.txt b/tests/util/server/src/testdata/wrk2.txt similarity index 100% rename from test_util/src/testdata/wrk2.txt rename to tests/util/server/src/testdata/wrk2.txt diff --git a/test_util/src/testdata/wrk3.txt b/tests/util/server/src/testdata/wrk3.txt similarity index 100% rename from test_util/src/testdata/wrk3.txt rename to tests/util/server/src/testdata/wrk3.txt diff --git a/tools/release/deno_workspace.ts b/tools/release/deno_workspace.ts index 7e249cf2d4..e55a02b73f 100644 --- a/tools/release/deno_workspace.ts +++ b/tools/release/deno_workspace.ts @@ -35,7 +35,7 @@ export class DenoWorkspace { getCliDependencyCrates() { return this.getCliCrate() .descendantDependenciesInRepo() - .filter((c) => c.name !== "test_util"); + .filter((c) => c.name !== "test_server"); } getCliCrate() {