1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: move cli/tests/ -> tests/ (#22369)

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.
This commit is contained in:
Matt Mastracci 2024-02-10 13:22:13 -07:00 committed by Divy Srivastava
parent 3d5f42d158
commit 6016881eaa
3449 changed files with 273 additions and 280 deletions

View file

@ -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",

6
.gitattributes vendored
View file

@ -2,11 +2,11 @@
* 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.
@ -14,4 +14,4 @@
/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

View file

@ -6,7 +6,6 @@ members = [
"bench_util",
"cli",
"cli/napi/sym",
"cli/tests",
"ext/broadcast_channel",
"ext/cache",
"ext/canvas",
@ -32,6 +31,7 @@ members = [
"test_ffi",
"test_napi",
"test_util",
"tests",
]
exclude = ["test_util/std/hash/_wasm"]

View file

@ -19,7 +19,7 @@ doc = false
[[test]]
name = "integration"
path = "tests/integration_tests_runner.rs"
path = "../tests/integration_tests_runner.rs"
harness = false
[[bench]]

View file

@ -37,7 +37,7 @@ 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,
),
(
@ -45,23 +45,19 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"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),
),
(
@ -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,
),
@ -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,
),
@ -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,
),
@ -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,
),
(
@ -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();

View file

@ -1,5 +0,0 @@
{
"imports": {
"@test_util/": "../../../test_util/"
}
}

View file

@ -1,5 +0,0 @@
{
"imports": {
"@test_util/": "../../../test_util/"
}
}

View file

@ -1,3 +0,0 @@
export { assertStrictEquals } from "../../../../../test_util/std/assert/mod.ts";
export * from "./interface.ts";

View file

@ -1,2 +0,0 @@
[WILDCARD]Warning: Resolving "fs" as "node:fs" at file:///[WILDCARD]/cli/tests/testdata/run/node_prefix_missing/main.ts:1:16. If you want to use a built-in Node module, add a "node:" prefix.
[Function: writeFile]

View file

@ -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 {

View file

@ -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;
@ -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 {

5
tests/config/deno.json Normal file
View file

@ -0,0 +1,5 @@
{
"imports": {
"@test_util/": "../../test_util/"
}
}

View file

@ -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);
@ -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()

View file

@ -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://127.0.0.1:4545/")

View file

@ -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")

View file

@ -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,

View file

@ -0,0 +1,5 @@
{
"imports": {
"@test_util/": "../../test_util/"
}
}

View file

@ -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' });

Some files were not shown because too many files have changed in this diff Show more