Skip to content

Commit

Permalink
chore: move cli/tests/ -> tests/ (denoland#22369)
Browse files Browse the repository at this point in the history
This looks like a massive PR, but it's only a move from cli/tests ->
tests, and updates of relative paths for files.

This is the first step towards aggregate all of the integration test
files under tests/, which will lead to a set of integration tests that
can run without the CLI binary being built.

While we could leave these tests under `cli`, it would require us to
keep a more complex directory structure for the various test runners. In
addition, we have a lot of complexity to ignore various test files in
the `cli` project itself (cargo publish exclusion rules, autotests =
false, etc).

And finally, the `tests/` folder will eventually house the `test_ffi`,
`test_napi` and other testing code, reducing the size of the root repo
directory.

For easier review, the extremely large and noisy "move" is in the first
commit (with no changes -- just a move), while the remainder of the
changes to actual files is in the second commit.
  • Loading branch information
mmastrac committed Feb 10, 2024
1 parent d2477f7 commit f5e46c9
Show file tree
Hide file tree
Showing 3,450 changed files with 281 additions and 288 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
30 changes: 15 additions & 15 deletions .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
"cli/tsc/dts/lib.es*.d.ts",
"cli/tsc/dts/typescript.d.ts",
"cli/tests/node_compat/test",
"cli/tests/testdata/file_extensions/ts_with_js_extension.js",
"cli/tests/testdata/fmt/badly_formatted.json",
"cli/tests/testdata/fmt/badly_formatted.md",
"cli/tests/testdata/fmt/badly_formatted.ipynb",
"cli/tests/testdata/byte_order_mark.ts",
"cli/tests/testdata/encoding",
"cli/tests/testdata/fmt/",
"cli/tests/testdata/lint/glob/",
"cli/tests/testdata/test/glob/",
"cli/tests/testdata/import_attributes/json_with_shebang.json",
"cli/tests/testdata/run/error_syntax_empty_trailing_line.mjs",
"cli/tests/testdata/run/inline_js_source_map*",
"cli/tests/testdata/malformed_config/",
"cli/tests/testdata/npm/registry/",
"cli/tests/testdata/test/markdown_windows.md",
"tests/testdata/file_extensions/ts_with_js_extension.js",
"tests/testdata/fmt/badly_formatted.json",
"tests/testdata/fmt/badly_formatted.md",
"tests/testdata/fmt/badly_formatted.ipynb",
"tests/testdata/byte_order_mark.ts",
"tests/testdata/encoding",
"tests/testdata/fmt/",
"tests/testdata/lint/glob/",
"tests/testdata/test/glob/",
"tests/testdata/import_attributes/json_with_shebang.json",
"tests/testdata/run/error_syntax_empty_trailing_line.mjs",
"tests/testdata/run/inline_js_source_map*",
"tests/testdata/malformed_config/",
"tests/testdata/npm/registry/",
"tests/testdata/test/markdown_windows.md",
"cli/tsc/*typescript.js",
"gh-pages",
"target",
Expand Down
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
* text=auto eol=lf
*.png -text

/cli/tests/testdata/encoding/* -text
/tests/testdata/encoding/* -text

# Tell git which symlinks point to files, and which ones point to directories.
# This is relevant for Windows only, and requires git >= 2.19.2 to work.
/cli/tests/testdata/symlink_to_subdir symlink=dir
/tests/testdata/symlink_to_subdir symlink=dir

# Tell github these are vendored files.
# Doesn't include them in the language statistics.
/cli/tsc/00_typescript.js linguist-vendored
/cli/dts/* linguist-vendored

# Keep Windows line endings in cross-platform doc check test file
/cli/tests/testdata/test/markdown_windows.md eol=crlf
/tests/testdata/test/markdown_windows.md eol=crlf
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ members = [
"bench_util",
"cli",
"cli/napi/sym",
"cli/tests",
"ext/broadcast_channel",
"ext/cache",
"ext/canvas",
Expand All @@ -32,6 +31,7 @@ members = [
"test_ffi",
"test_napi",
"test_util",
"tests",
]
exclude = ["test_util/std/hash/_wasm"]

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ doc = false

[[test]]
name = "integration"
path = "tests/integration_tests_runner.rs"
path = "../tests/integration_tests_runner.rs"
harness = false

[[bench]]
Expand Down
35 changes: 14 additions & 21 deletions cli/bench/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,27 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
// invalidating that cache.
(
"cold_hello",
&["run", "--reload", "cli/tests/testdata/run/002_hello.ts"],
&["run", "--reload", "tests/testdata/run/002_hello.ts"],
None,
),
(
"cold_relative_import",
&[
"run",
"--reload",
"cli/tests/testdata/run/003_relative_import.ts",
"tests/testdata/run/003_relative_import.ts",
],
None,
),
(
"hello",
&["run", "cli/tests/testdata/run/002_hello.ts"],
None,
),
("hello", &["run", "tests/testdata/run/002_hello.ts"], None),
(
"relative_import",
&["run", "cli/tests/testdata/run/003_relative_import.ts"],
&["run", "tests/testdata/run/003_relative_import.ts"],
None,
),
(
"error_001",
&["run", "cli/tests/testdata/run/error_001.ts"],
&["run", "tests/testdata/run/error_001.ts"],
Some(1),
),
(
Expand All @@ -70,7 +66,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
"run",
"--reload",
"--no-check",
"cli/tests/testdata/run/002_hello.ts",
"tests/testdata/run/002_hello.ts",
],
None,
),
Expand All @@ -79,7 +75,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"run",
"--allow-read",
"cli/tests/testdata/workers/bench_startup.ts",
"tests/testdata/workers/bench_startup.ts",
],
None,
),
Expand All @@ -88,7 +84,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"run",
"--allow-read",
"cli/tests/testdata/workers/bench_round_robin.ts",
"tests/testdata/workers/bench_round_robin.ts",
],
None,
),
Expand All @@ -97,31 +93,28 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"run",
"--allow-read",
"cli/tests/testdata/workers/bench_large_message.ts",
"tests/testdata/workers/bench_large_message.ts",
],
None,
),
(
"text_decoder",
&["run", "cli/tests/testdata/benches/text_decoder_perf.js"],
&["run", "tests/testdata/benches/text_decoder_perf.js"],
None,
),
(
"text_encoder",
&["run", "cli/tests/testdata/benches/text_encoder_perf.js"],
&["run", "tests/testdata/benches/text_encoder_perf.js"],
None,
),
(
"text_encoder_into",
&[
"run",
"cli/tests/testdata/benches/text_encoder_into_perf.js",
],
&["run", "tests/testdata/benches/text_encoder_into_perf.js"],
None,
),
(
"response_string",
&["run", "cli/tests/testdata/benches/response_string_perf.js"],
&["run", "tests/testdata/benches/response_string_perf.js"],
None,
),
(
Expand Down Expand Up @@ -314,7 +307,7 @@ fn get_binary_sizes(target_dir: &Path) -> Result<HashMap<String, i64>> {

const BUNDLES: &[(&str, &str)] = &[
("file_server", "./test_util/std/http/file_server.ts"),
("welcome", "./cli/tests/testdata/welcome.ts"),
("welcome", "./tests/testdata/welcome.ts"),
];
fn bundle_benchmark(deno_exe: &Path) -> Result<HashMap<String, i64>> {
let mut sizes = HashMap::<String, i64>::new();
Expand Down
5 changes: 0 additions & 5 deletions cli/tests/config/deno.json

This file was deleted.

5 changes: 0 additions & 5 deletions cli/tests/node_compat/deno.json

This file was deleted.

3 changes: 0 additions & 3 deletions cli/tests/testdata/coverage/no_transpiled_lines/index.ts

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions cli/tests/testdata/test/ops_sanitizer_step_leak.out

This file was deleted.

2 changes: 1 addition & 1 deletion test_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn prebuilt_path() -> PathRef {
}

pub fn tests_path() -> PathRef {
root_path().join("cli").join("tests")
root_path().join("tests")
}

pub fn testdata_path() -> PathRef {
Expand Down
6 changes: 3 additions & 3 deletions test_util/src/servers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ async fn get_tcp_listener_stream(

/// This server responds with 'PASS' if client authentication was successful. Try it by running
/// test_server and
/// curl --key cli/tests/testdata/tls/localhost.key \
/// curl --key tests/testdata/tls/localhost.key \
/// --cert cli/tests/testsdata/tls/localhost.crt \
/// --cacert cli/tests/testdata/tls/RootCA.crt https://localhost:4552/
/// --cacert tests/testdata/tls/RootCA.crt https://localhost:4552/
async fn run_tls_client_auth_server(port: u16) {
let mut tls =
get_tls_listener_stream("tls client auth", port, Default::default()).await;
Expand All @@ -352,7 +352,7 @@ async fn run_tls_client_auth_server(port: u16) {

/// This server responds with 'PASS' if client authentication was successful. Try it by running
/// test_server and
/// curl --cacert cli/tests/testdata/tls/RootCA.crt https://localhost:4553/
/// curl --cacert tests/testdata/tls/RootCA.crt https://localhost:4553/
async fn run_tls_server(port: u16) {
let mut tls = get_tls_listener_stream("tls", port, Default::default()).await;
while let Some(Ok(mut tls_stream)) = tls.next().await {
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/config/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@test_util/": "../../test_util/"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn compile_basic() {
"compile",
"--output",
&exe.to_string_lossy(),
"../../../cli/tests/testdata/welcome.ts",
"../../tests/testdata/welcome.ts",
])
.run();
output.assert_exit_code(0);
Expand Down Expand Up @@ -706,7 +706,7 @@ fn dynamic_import_unanalyzable() {

context
.new_command()
.current_dir(util::root_path().join("cli"))
.current_dir(util::root_path())
.name(&exe)
.env("NO_COLOR", "")
.run()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn js_unit_test(test: String) {
.current_dir(util::root_path())
.arg("test")
.arg("--config")
.arg("cli/tests/config/deno.json")
.arg("tests/config/deno.json")
.arg("--no-lock")
.arg("--unstable")
.arg("--location=http:https://127.0.0.1:4545/")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn node_compat_tests() {
.current_dir(util::root_path())
.arg("test")
.arg("--config")
.arg("cli/tests/config/deno.json")
.arg("tests/config/deno.json")
.arg("--no-lock")
.arg("--unstable")
.arg("-A")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn node_unit_test(test: String) {
.current_dir(util::root_path())
.arg("test")
.arg("--config")
.arg("cli/tests/config/deno.json")
.arg("tests/config/deno.json")
.arg("--no-lock")
.arg("--unstable")
// TODO(kt3k): This option is required to pass tls_test.ts,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/node_compat/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"@test_util/": "../../test_util/"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const assert = require('assert');
const assert = require("assert");
// TODO(kt3k): Uncomment this when util.debuglog is added
// const debug = require('util').debuglog('test');
const debug = console.log;

function onmessage(m) {
debug('CHILD got message:', m);
debug("CHILD got message:", m);
assert.ok(m.hello);
process.removeListener('message', onmessage);
process.removeListener("message", onmessage);
}

process.on('message', onmessage);
process.on("message", onmessage);
// TODO(kt3k): Uncomment the below when the ipc features are ready
// process.send({ foo: 'bar' });
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f5e46c9

Please sign in to comment.