mirror of
https://github.com/denoland/deno.git
synced 2025-02-12 16:59:32 -05:00
refactor: move out test files from root testdata directory into sub directories (#15949)
This commit is contained in:
parent
34d351ac1d
commit
327a0081de
816 changed files with 2430 additions and 2425 deletions
|
@ -27,13 +27,13 @@
|
||||||
"cli/dts/lib.scripthost.d.ts",
|
"cli/dts/lib.scripthost.d.ts",
|
||||||
"cli/dts/lib.webworker*.d.ts",
|
"cli/dts/lib.webworker*.d.ts",
|
||||||
"cli/dts/typescript.d.ts",
|
"cli/dts/typescript.d.ts",
|
||||||
"cli/tests/testdata/badly_formatted.json",
|
"cli/tests/testdata/fmt/badly_formatted.json",
|
||||||
"cli/tests/testdata/badly_formatted.md",
|
"cli/tests/testdata/fmt/badly_formatted.md",
|
||||||
"cli/tests/testdata/byte_order_mark.ts",
|
"cli/tests/testdata/byte_order_mark.ts",
|
||||||
"cli/tests/testdata/encoding",
|
"cli/tests/testdata/encoding",
|
||||||
"cli/tests/testdata/fmt/*",
|
"cli/tests/testdata/fmt/*",
|
||||||
"cli/tests/testdata/import_assertions/json_with_shebang.json",
|
"cli/tests/testdata/import_assertions/json_with_shebang.json",
|
||||||
"cli/tests/testdata/inline_js_source_map*",
|
"cli/tests/testdata/run/inline_js_source_map*",
|
||||||
"cli/tests/testdata/malformed_config/*",
|
"cli/tests/testdata/malformed_config/*",
|
||||||
"cli/tests/testdata/npm/registry/",
|
"cli/tests/testdata/npm/registry/",
|
||||||
"cli/tests/testdata/test/markdown_windows.md",
|
"cli/tests/testdata/test/markdown_windows.md",
|
||||||
|
|
|
@ -35,7 +35,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
|
||||||
// invalidating that cache.
|
// invalidating that cache.
|
||||||
(
|
(
|
||||||
"cold_hello",
|
"cold_hello",
|
||||||
&["run", "--reload", "cli/tests/testdata/002_hello.ts"],
|
&["run", "--reload", "cli/tests/testdata/run/002_hello.ts"],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -43,19 +43,23 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
|
||||||
&[
|
&[
|
||||||
"run",
|
"run",
|
||||||
"--reload",
|
"--reload",
|
||||||
"cli/tests/testdata/003_relative_import.ts",
|
"cli/tests/testdata/run/003_relative_import.ts",
|
||||||
],
|
],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
("hello", &["run", "cli/tests/testdata/002_hello.ts"], None),
|
(
|
||||||
|
"hello",
|
||||||
|
&["run", "cli/tests/testdata/run/002_hello.ts"],
|
||||||
|
None,
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"relative_import",
|
"relative_import",
|
||||||
&["run", "cli/tests/testdata/003_relative_import.ts"],
|
&["run", "cli/tests/testdata/run/003_relative_import.ts"],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"error_001",
|
"error_001",
|
||||||
&["run", "cli/tests/testdata/error_001.ts"],
|
&["run", "cli/tests/testdata/run/error_001.ts"],
|
||||||
Some(1),
|
Some(1),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -64,7 +68,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
|
||||||
"run",
|
"run",
|
||||||
"--reload",
|
"--reload",
|
||||||
"--no-check",
|
"--no-check",
|
||||||
"cli/tests/testdata/002_hello.ts",
|
"cli/tests/testdata/run/002_hello.ts",
|
||||||
],
|
],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
|
@ -97,22 +101,25 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"text_decoder",
|
"text_decoder",
|
||||||
&["run", "cli/tests/testdata/text_decoder_perf.js"],
|
&["run", "cli/tests/testdata/benches/text_decoder_perf.js"],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"text_encoder",
|
"text_encoder",
|
||||||
&["run", "cli/tests/testdata/text_encoder_perf.js"],
|
&["run", "cli/tests/testdata/benches/text_encoder_perf.js"],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"text_encoder_into",
|
"text_encoder_into",
|
||||||
&["run", "cli/tests/testdata/text_encoder_into_perf.js"],
|
&[
|
||||||
|
"run",
|
||||||
|
"cli/tests/testdata/benches/text_encoder_into_perf.js",
|
||||||
|
],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"response_string",
|
"response_string",
|
||||||
&["run", "cli/tests/testdata/response_string_perf.js"],
|
&["run", "cli/tests/testdata/benches/response_string_perf.js"],
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -1535,7 +1535,8 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap();
|
let specifier =
|
||||||
|
resolve_url("http://localhost:4545/run/002_hello.ts").unwrap();
|
||||||
|
|
||||||
let result = file_fetcher
|
let result = file_fetcher
|
||||||
.fetch(&specifier, &mut Permissions::allow_all())
|
.fetch(&specifier, &mut Permissions::allow_all())
|
||||||
|
@ -1543,7 +1544,7 @@ mod tests {
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
let err = result.unwrap_err();
|
let err = result.unwrap_err();
|
||||||
assert_eq!(get_custom_error_class(&err), Some("NoRemote"));
|
assert_eq!(get_custom_error_class(&err), Some("NoRemote"));
|
||||||
assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/002_hello.ts\", but --no-remote is specified.");
|
assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/run/002_hello.ts\", but --no-remote is specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -1569,7 +1570,8 @@ mod tests {
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap();
|
let specifier =
|
||||||
|
resolve_url("http://localhost:4545/run/002_hello.ts").unwrap();
|
||||||
|
|
||||||
let result = file_fetcher_01
|
let result = file_fetcher_01
|
||||||
.fetch(&specifier, &mut Permissions::allow_all())
|
.fetch(&specifier, &mut Permissions::allow_all())
|
||||||
|
@ -1577,7 +1579,7 @@ mod tests {
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
let err = result.unwrap_err();
|
let err = result.unwrap_err();
|
||||||
assert_eq!(get_custom_error_class(&err), Some("NotCached"));
|
assert_eq!(get_custom_error_class(&err), Some("NotCached"));
|
||||||
assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/002_hello.ts\", --cached-only is specified.");
|
assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/run/002_hello.ts\", --cached-only is specified.");
|
||||||
|
|
||||||
let result = file_fetcher_02
|
let result = file_fetcher_02
|
||||||
.fetch(&specifier, &mut Permissions::allow_all())
|
.fetch(&specifier, &mut Permissions::allow_all())
|
||||||
|
|
|
@ -542,8 +542,8 @@ mod tests {
|
||||||
assert!(!is_supported_ext(Path::new("tests/subdir/redirects")));
|
assert!(!is_supported_ext(Path::new("tests/subdir/redirects")));
|
||||||
assert!(!is_supported_ext(Path::new("README.md")));
|
assert!(!is_supported_ext(Path::new("README.md")));
|
||||||
assert!(is_supported_ext(Path::new("lib/typescript.d.ts")));
|
assert!(is_supported_ext(Path::new("lib/typescript.d.ts")));
|
||||||
assert!(is_supported_ext(Path::new("testdata/001_hello.js")));
|
assert!(is_supported_ext(Path::new("testdata/run/001_hello.js")));
|
||||||
assert!(is_supported_ext(Path::new("testdata/002_hello.ts")));
|
assert!(is_supported_ext(Path::new("testdata/run/002_hello.ts")));
|
||||||
assert!(is_supported_ext(Path::new("foo.jsx")));
|
assert!(is_supported_ext(Path::new("foo.jsx")));
|
||||||
assert!(is_supported_ext(Path::new("foo.tsx")));
|
assert!(is_supported_ext(Path::new("foo.tsx")));
|
||||||
assert!(is_supported_ext(Path::new("foo.TS")));
|
assert!(is_supported_ext(Path::new("foo.TS")));
|
||||||
|
@ -563,8 +563,12 @@ mod tests {
|
||||||
assert!(is_supported_test_ext(Path::new("README.md")));
|
assert!(is_supported_test_ext(Path::new("README.md")));
|
||||||
assert!(is_supported_test_ext(Path::new("readme.MD")));
|
assert!(is_supported_test_ext(Path::new("readme.MD")));
|
||||||
assert!(is_supported_test_ext(Path::new("lib/typescript.d.ts")));
|
assert!(is_supported_test_ext(Path::new("lib/typescript.d.ts")));
|
||||||
assert!(is_supported_test_ext(Path::new("testdata/001_hello.js")));
|
assert!(is_supported_test_ext(Path::new(
|
||||||
assert!(is_supported_test_ext(Path::new("testdata/002_hello.ts")));
|
"testdata/run/001_hello.js"
|
||||||
|
)));
|
||||||
|
assert!(is_supported_test_ext(Path::new(
|
||||||
|
"testdata/run/002_hello.ts"
|
||||||
|
)));
|
||||||
assert!(is_supported_test_ext(Path::new("foo.jsx")));
|
assert!(is_supported_test_ext(Path::new("foo.jsx")));
|
||||||
assert!(is_supported_test_ext(Path::new("foo.tsx")));
|
assert!(is_supported_test_ext(Path::new("foo.tsx")));
|
||||||
assert!(is_supported_test_ext(Path::new("foo.TS")));
|
assert!(is_supported_test_ext(Path::new("foo.TS")));
|
||||||
|
|
|
@ -324,7 +324,7 @@ mod tests {
|
||||||
async fn test_fetch_string() {
|
async fn test_fetch_string() {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url = Url::parse("http://127.0.0.1:4545/fixture.json").unwrap();
|
let url = Url::parse("http://127.0.0.1:4545/assets/fixture.json").unwrap();
|
||||||
let client = create_test_client();
|
let client = create_test_client();
|
||||||
let result = fetch_once(FetchOnceArgs {
|
let result = fetch_once(FetchOnceArgs {
|
||||||
client,
|
client,
|
||||||
|
@ -348,7 +348,7 @@ mod tests {
|
||||||
async fn test_fetch_gzip() {
|
async fn test_fetch_gzip() {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url = Url::parse("http://127.0.0.1:4545/053_import_compression/gziped")
|
let url = Url::parse("http://127.0.0.1:4545/run/import_compression/gziped")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let client = create_test_client();
|
let client = create_test_client();
|
||||||
let result = fetch_once(FetchOnceArgs {
|
let result = fetch_once(FetchOnceArgs {
|
||||||
|
@ -412,7 +412,7 @@ mod tests {
|
||||||
async fn test_fetch_brotli() {
|
async fn test_fetch_brotli() {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url = Url::parse("http://127.0.0.1:4545/053_import_compression/brotli")
|
let url = Url::parse("http://127.0.0.1:4545/run/import_compression/brotli")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let client = create_test_client();
|
let client = create_test_client();
|
||||||
let result = fetch_once(FetchOnceArgs {
|
let result = fetch_once(FetchOnceArgs {
|
||||||
|
@ -462,9 +462,10 @@ mod tests {
|
||||||
async fn test_fetch_once_with_redirect() {
|
async fn test_fetch_once_with_redirect() {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url = Url::parse("http://127.0.0.1:4546/fixture.json").unwrap();
|
let url = Url::parse("http://127.0.0.1:4546/assets/fixture.json").unwrap();
|
||||||
// Dns resolver substitutes `127.0.0.1` with `localhost`
|
// Dns resolver substitutes `127.0.0.1` with `localhost`
|
||||||
let target_url = Url::parse("http://localhost:4545/fixture.json").unwrap();
|
let target_url =
|
||||||
|
Url::parse("http://localhost:4545/assets/fixture.json").unwrap();
|
||||||
let client = create_test_client();
|
let client = create_test_client();
|
||||||
let result = fetch_once(FetchOnceArgs {
|
let result = fetch_once(FetchOnceArgs {
|
||||||
client,
|
client,
|
||||||
|
@ -523,7 +524,7 @@ mod tests {
|
||||||
async fn test_fetch_with_cafile_string() {
|
async fn test_fetch_with_cafile_string() {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url = Url::parse("https://localhost:5545/fixture.json").unwrap();
|
let url = Url::parse("https://localhost:5545/assets/fixture.json").unwrap();
|
||||||
|
|
||||||
let client = create_http_client(
|
let client = create_http_client(
|
||||||
version::get_user_agent(),
|
version::get_user_agent(),
|
||||||
|
@ -630,7 +631,7 @@ mod tests {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url =
|
let url =
|
||||||
Url::parse("https://localhost:5545/053_import_compression/gziped")
|
Url::parse("https://localhost:5545/run/import_compression/gziped")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let client = create_http_client(
|
let client = create_http_client(
|
||||||
version::get_user_agent(),
|
version::get_user_agent(),
|
||||||
|
@ -724,7 +725,7 @@ mod tests {
|
||||||
let _http_server_guard = test_util::http_server();
|
let _http_server_guard = test_util::http_server();
|
||||||
// Relies on external http server. See target/debug/test_server
|
// Relies on external http server. See target/debug/test_server
|
||||||
let url =
|
let url =
|
||||||
Url::parse("https://localhost:5545/053_import_compression/brotli")
|
Url::parse("https://localhost:5545/run/import_compression/brotli")
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let client = create_http_client(
|
let client = create_http_client(
|
||||||
version::get_user_agent(),
|
version::get_user_agent(),
|
||||||
|
|
|
@ -231,27 +231,27 @@ fn bundle_js() {
|
||||||
#[test]
|
#[test]
|
||||||
fn bundle_dynamic_import() {
|
fn bundle_dynamic_import() {
|
||||||
let _g = util::http_server();
|
let _g = util::http_server();
|
||||||
let dynamic_import = util::testdata_path().join("bundle_dynamic_import.ts");
|
let dynamic_import = util::testdata_path().join("bundle/dynamic_import.ts");
|
||||||
assert!(dynamic_import.is_file());
|
assert!(dynamic_import.is_file());
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let bundle = t.path().join("bundle_dynamic_import.bundle.js");
|
let output_path = t.path().join("bundle_dynamic_import.bundle.js");
|
||||||
let mut deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("bundle")
|
.arg("bundle")
|
||||||
.arg(dynamic_import)
|
.arg(dynamic_import)
|
||||||
.arg(&bundle)
|
.arg(&output_path)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let status = deno.wait().unwrap();
|
let status = deno.wait().unwrap();
|
||||||
assert!(status.success());
|
assert!(status.success());
|
||||||
assert!(bundle.is_file());
|
assert!(output_path.is_file());
|
||||||
|
|
||||||
let output = util::deno_cmd()
|
let output = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("--allow-net")
|
.arg("--allow-net")
|
||||||
.arg("--quiet")
|
.arg("--quiet")
|
||||||
.arg(&bundle)
|
.arg(&output_path)
|
||||||
.output()
|
.output()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
// check the output of the test.ts program.
|
// check the output of the test.ts program.
|
||||||
|
@ -264,23 +264,24 @@ fn bundle_dynamic_import() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bundle_import_map() {
|
fn bundle_import_map() {
|
||||||
let import = util::testdata_path().join("bundle_im.ts");
|
let import = util::testdata_path().join("bundle/import_map/main.ts");
|
||||||
let import_map_path = util::testdata_path().join("bundle_im.json");
|
let import_map_path =
|
||||||
|
util::testdata_path().join("bundle/import_map/import_map.json");
|
||||||
assert!(import.is_file());
|
assert!(import.is_file());
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let bundle = t.path().join("import_map.bundle.js");
|
let output_path = t.path().join("import_map.bundle.js");
|
||||||
let mut deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("bundle")
|
.arg("bundle")
|
||||||
.arg("--import-map")
|
.arg("--import-map")
|
||||||
.arg(import_map_path)
|
.arg(import_map_path)
|
||||||
.arg(import)
|
.arg(import)
|
||||||
.arg(&bundle)
|
.arg(&output_path)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let status = deno.wait().unwrap();
|
let status = deno.wait().unwrap();
|
||||||
assert!(status.success());
|
assert!(status.success());
|
||||||
assert!(bundle.is_file());
|
assert!(output_path.is_file());
|
||||||
|
|
||||||
// Now we try to use that bundle from another module.
|
// Now we try to use that bundle from another module.
|
||||||
let test = t.path().join("test.js");
|
let test = t.path().join("test.js");
|
||||||
|
@ -309,23 +310,24 @@ fn bundle_import_map() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bundle_import_map_no_check() {
|
fn bundle_import_map_no_check() {
|
||||||
let import = util::testdata_path().join("bundle_im.ts");
|
let import = util::testdata_path().join("bundle/import_map/main.ts");
|
||||||
let import_map_path = util::testdata_path().join("bundle_im.json");
|
let import_map_path =
|
||||||
|
util::testdata_path().join("bundle/import_map/import_map.json");
|
||||||
assert!(import.is_file());
|
assert!(import.is_file());
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let bundle = t.path().join("import_map.bundle.js");
|
let output_path = t.path().join("import_map.bundle.js");
|
||||||
let mut deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("bundle")
|
.arg("bundle")
|
||||||
.arg("--import-map")
|
.arg("--import-map")
|
||||||
.arg(import_map_path)
|
.arg(import_map_path)
|
||||||
.arg(import)
|
.arg(import)
|
||||||
.arg(&bundle)
|
.arg(&output_path)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let status = deno.wait().unwrap();
|
let status = deno.wait().unwrap();
|
||||||
assert!(status.success());
|
assert!(status.success());
|
||||||
assert!(bundle.is_file());
|
assert!(output_path.is_file());
|
||||||
|
|
||||||
// Now we try to use that bundle from another module.
|
// Now we try to use that bundle from another module.
|
||||||
let test = t.path().join("test.js");
|
let test = t.path().join("test.js");
|
||||||
|
@ -414,32 +416,32 @@ fn bundle_json_module_escape_sub() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
itest!(lock_check_err_with_bundle {
|
itest!(lockfile_check_error {
|
||||||
args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/subdir/mod1.ts",
|
args: "bundle --lock=bundle/lockfile/check_error.json http://127.0.0.1:4545/subdir/mod1.ts",
|
||||||
output: "lock_check_err_with_bundle.out",
|
output: "bundle/lockfile/check_error.out",
|
||||||
exit_code: 10,
|
exit_code: 10,
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(bundle {
|
itest!(bundle {
|
||||||
args: "bundle subdir/mod1.ts",
|
args: "bundle subdir/mod1.ts",
|
||||||
output: "bundle.test.out",
|
output: "bundle/bundle.test.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(bundle_jsx {
|
itest!(bundle_jsx {
|
||||||
args: "bundle jsx_import_from_ts.ts",
|
args: "bundle run/jsx_import_from_ts.ts",
|
||||||
output: "bundle_jsx.out",
|
output: "bundle/jsx.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(error_027_bundle_with_bare_import {
|
itest!(error_bundle_with_bare_import {
|
||||||
args: "bundle error_027_bundle_with_bare_import.ts",
|
args: "bundle bundle/bare_imports/error_with_bare_import.ts",
|
||||||
output: "error_027_bundle_with_bare_import.ts.out",
|
output: "bundle/bare_imports/error_with_bare_import.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(ts_decorators_bundle {
|
itest!(ts_decorators_bundle {
|
||||||
args: "bundle ts_decorators_bundle.ts",
|
args: "bundle bundle/decorators/ts_decorators.ts",
|
||||||
output: "ts_decorators_bundle.out",
|
output: "bundle/decorators/ts_decorators.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(bundle_export_specifier_with_alias {
|
itest!(bundle_export_specifier_with_alias {
|
||||||
|
@ -449,18 +451,18 @@ itest!(bundle_export_specifier_with_alias {
|
||||||
|
|
||||||
itest!(bundle_ignore_directives {
|
itest!(bundle_ignore_directives {
|
||||||
args: "bundle subdir/mod1.ts",
|
args: "bundle subdir/mod1.ts",
|
||||||
output: "bundle_ignore_directives.test.out",
|
output: "bundle/ignore_directives.test.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_local_by_default {
|
itest!(check_local_by_default_no_errors {
|
||||||
args: "bundle --quiet bundle/check_local_by_default.ts",
|
args: "bundle --quiet bundle/check_local_by_default/no_errors.ts",
|
||||||
output: "bundle/check_local_by_default.out",
|
output: "bundle/check_local_by_default/no_errors.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_local_by_default2 {
|
itest!(check_local_by_default_type_error {
|
||||||
args: "bundle --quiet bundle/check_local_by_default2.ts",
|
args: "bundle --quiet bundle/check_local_by_default/type_error.ts",
|
||||||
output: "bundle/check_local_by_default2.out",
|
output: "bundle/check_local_by_default/type_error.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,48 +5,48 @@ use crate::itest;
|
||||||
itest!(_036_import_map_fetch {
|
itest!(_036_import_map_fetch {
|
||||||
args:
|
args:
|
||||||
"cache --quiet --reload --import-map=import_maps/import_map.json import_maps/test.ts",
|
"cache --quiet --reload --import-map=import_maps/import_map.json import_maps/test.ts",
|
||||||
output: "036_import_map_fetch.out",
|
output: "cache/036_import_map_fetch.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_037_fetch_multiple {
|
itest!(_037_fetch_multiple {
|
||||||
args: "cache --reload --check=all fetch/test.ts fetch/other.ts",
|
args: "cache --reload --check=all run/fetch/test.ts run/fetch/other.ts",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
output: "037_fetch_multiple.out",
|
output: "cache/037_fetch_multiple.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_095_cache_with_bare_import {
|
itest!(_095_cache_with_bare_import {
|
||||||
args: "cache 095_cache_with_bare_import.ts",
|
args: "cache cache/095_cache_with_bare_import.ts",
|
||||||
output: "095_cache_with_bare_import.ts.out",
|
output: "cache/095_cache_with_bare_import.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(cache_extensionless {
|
itest!(cache_extensionless {
|
||||||
args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext",
|
args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext",
|
||||||
output: "cache_extensionless.out",
|
output: "cache/cache_extensionless.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(cache_random_extension {
|
itest!(cache_random_extension {
|
||||||
args:
|
args:
|
||||||
"cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0",
|
"cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0",
|
||||||
output: "cache_random_extension.out",
|
output: "cache/cache_random_extension.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(performance_stats {
|
itest!(performance_stats {
|
||||||
args: "cache --reload --check=all --log-level debug 002_hello.ts",
|
args: "cache --reload --check=all --log-level debug run/002_hello.ts",
|
||||||
output: "performance_stats.out",
|
output: "cache/performance_stats.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(redirect_cache {
|
itest!(redirect_cache {
|
||||||
http_server: true,
|
http_server: true,
|
||||||
args:
|
args:
|
||||||
"cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts",
|
"cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts",
|
||||||
output: "redirect_cache.out",
|
output: "cache/redirect_cache.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(ignore_require {
|
itest!(ignore_require {
|
||||||
args: "cache --reload --no-check ignore_require.js",
|
args: "cache --reload --no-check cache/ignore_require.js",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
});
|
});
|
||||||
|
@ -71,7 +71,7 @@ fn relative_home_dir() {
|
||||||
.arg("cache")
|
.arg("cache")
|
||||||
.arg("--reload")
|
.arg("--reload")
|
||||||
.arg("--no-check")
|
.arg("--no-check")
|
||||||
.arg("002_hello.ts")
|
.arg("run/002_hello.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
316
cli/tests/integration/cert_tests.rs
Normal file
316
cli/tests/integration/cert_tests.rs
Normal file
|
@ -0,0 +1,316 @@
|
||||||
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
use crate::itest;
|
||||||
|
use deno_runtime::deno_net::ops_tls::TlsStream;
|
||||||
|
use deno_runtime::deno_tls::rustls;
|
||||||
|
use deno_runtime::deno_tls::rustls_pemfile;
|
||||||
|
use std::io::BufReader;
|
||||||
|
use std::io::Cursor;
|
||||||
|
use std::io::Read;
|
||||||
|
use std::process::Command;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use test_util as util;
|
||||||
|
use test_util::TempDir;
|
||||||
|
use tokio::task::LocalSet;
|
||||||
|
|
||||||
|
itest_flaky!(cafile_url_imports {
|
||||||
|
args: "run --quiet --reload --cert tls/RootCA.pem cert/cafile_url_imports.ts",
|
||||||
|
output: "cert/cafile_url_imports.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest_flaky!(cafile_ts_fetch {
|
||||||
|
args:
|
||||||
|
"run --quiet --reload --allow-net --cert tls/RootCA.pem cert/cafile_ts_fetch.ts",
|
||||||
|
output: "cert/cafile_ts_fetch.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest_flaky!(cafile_eval {
|
||||||
|
args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cert/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))",
|
||||||
|
output: "cert/cafile_ts_fetch.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest_flaky!(cafile_info {
|
||||||
|
args:
|
||||||
|
"info --quiet --cert tls/RootCA.pem https://localhost:5545/cert/cafile_info.ts",
|
||||||
|
output: "cert/cafile_info.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest_flaky!(cafile_url_imports_unsafe_ssl {
|
||||||
|
args: "run --quiet --reload --unsafely-ignore-certificate-errors=localhost cert/cafile_url_imports.ts",
|
||||||
|
output: "cert/cafile_url_imports_unsafe_ssl.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest_flaky!(cafile_ts_fetch_unsafe_ssl {
|
||||||
|
args:
|
||||||
|
"run --quiet --reload --allow-net --unsafely-ignore-certificate-errors cert/cafile_ts_fetch.ts",
|
||||||
|
output: "cert/cafile_ts_fetch_unsafe_ssl.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
itest!(deno_land_unsafe_ssl {
|
||||||
|
args:
|
||||||
|
"run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cert/deno_land_unsafe_ssl.ts",
|
||||||
|
output: "cert/deno_land_unsafe_ssl.ts.out",
|
||||||
|
});
|
||||||
|
|
||||||
|
itest!(ip_address_unsafe_ssl {
|
||||||
|
args:
|
||||||
|
"run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=1.1.1.1 cert/ip_address_unsafe_ssl.ts",
|
||||||
|
output: "cert/ip_address_unsafe_ssl.ts.out",
|
||||||
|
});
|
||||||
|
|
||||||
|
itest!(localhost_unsafe_ssl {
|
||||||
|
args:
|
||||||
|
"run --quiet --reload --allow-net --unsafely-ignore-certificate-errors=deno.land cert/cafile_url_imports.ts",
|
||||||
|
output: "cert/localhost_unsafe_ssl.ts.out",
|
||||||
|
http_server: true,
|
||||||
|
exit_code: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
#[flaky_test::flaky_test]
|
||||||
|
fn cafile_env_fetch() {
|
||||||
|
use deno_core::url::Url;
|
||||||
|
let _g = util::http_server();
|
||||||
|
let deno_dir = TempDir::new();
|
||||||
|
let module_url =
|
||||||
|
Url::parse("https://localhost:5545/cert/cafile_url_imports.ts").unwrap();
|
||||||
|
let cafile = util::testdata_path().join("tls/RootCA.pem");
|
||||||
|
let output = Command::new(util::deno_exe_path())
|
||||||
|
.env("DENO_DIR", deno_dir.path())
|
||||||
|
.env("DENO_CERT", cafile)
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("cache")
|
||||||
|
.arg(module_url.to_string())
|
||||||
|
.output()
|
||||||
|
.expect("Failed to spawn script");
|
||||||
|
assert!(output.status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[flaky_test::flaky_test]
|
||||||
|
fn cafile_fetch() {
|
||||||
|
use deno_core::url::Url;
|
||||||
|
let _g = util::http_server();
|
||||||
|
let deno_dir = TempDir::new();
|
||||||
|
let module_url =
|
||||||
|
Url::parse("http://localhost:4545/cert/cafile_url_imports.ts").unwrap();
|
||||||
|
let cafile = util::testdata_path().join("tls/RootCA.pem");
|
||||||
|
let output = Command::new(util::deno_exe_path())
|
||||||
|
.env("DENO_DIR", deno_dir.path())
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("cache")
|
||||||
|
.arg("--cert")
|
||||||
|
.arg(cafile)
|
||||||
|
.arg(module_url.to_string())
|
||||||
|
.output()
|
||||||
|
.expect("Failed to spawn script");
|
||||||
|
assert!(output.status.success());
|
||||||
|
let out = std::str::from_utf8(&output.stdout).unwrap();
|
||||||
|
assert_eq!(out, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[flaky_test::flaky_test]
|
||||||
|
fn cafile_install_remote_module() {
|
||||||
|
let _g = util::http_server();
|
||||||
|
let temp_dir = TempDir::new();
|
||||||
|
let bin_dir = temp_dir.path().join("bin");
|
||||||
|
std::fs::create_dir(&bin_dir).unwrap();
|
||||||
|
let deno_dir = TempDir::new();
|
||||||
|
let cafile = util::testdata_path().join("tls/RootCA.pem");
|
||||||
|
|
||||||
|
let install_output = Command::new(util::deno_exe_path())
|
||||||
|
.env("DENO_DIR", deno_dir.path())
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("install")
|
||||||
|
.arg("--cert")
|
||||||
|
.arg(cafile)
|
||||||
|
.arg("--root")
|
||||||
|
.arg(temp_dir.path())
|
||||||
|
.arg("-n")
|
||||||
|
.arg("echo_test")
|
||||||
|
.arg("https://localhost:5545/echo.ts")
|
||||||
|
.output()
|
||||||
|
.expect("Failed to spawn script");
|
||||||
|
println!("{}", std::str::from_utf8(&install_output.stdout).unwrap());
|
||||||
|
eprintln!("{}", std::str::from_utf8(&install_output.stderr).unwrap());
|
||||||
|
assert!(install_output.status.success());
|
||||||
|
|
||||||
|
let mut echo_test_path = bin_dir.join("echo_test");
|
||||||
|
if cfg!(windows) {
|
||||||
|
echo_test_path = echo_test_path.with_extension("cmd");
|
||||||
|
}
|
||||||
|
assert!(echo_test_path.exists());
|
||||||
|
|
||||||
|
let output = Command::new(echo_test_path)
|
||||||
|
.current_dir(temp_dir.path())
|
||||||
|
.arg("foo")
|
||||||
|
.env("PATH", util::target_dir())
|
||||||
|
.output()
|
||||||
|
.expect("failed to spawn script");
|
||||||
|
let stdout = std::str::from_utf8(&output.stdout).unwrap().trim();
|
||||||
|
assert!(stdout.ends_with("foo"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[flaky_test::flaky_test]
|
||||||
|
fn cafile_bundle_remote_exports() {
|
||||||
|
let _g = util::http_server();
|
||||||
|
|
||||||
|
// First we have to generate a bundle of some remote module that has exports.
|
||||||
|
let mod1 = "https://localhost:5545/subdir/mod1.ts";
|
||||||
|
let cafile = util::testdata_path().join("tls/RootCA.pem");
|
||||||
|
let t = TempDir::new();
|
||||||
|
let bundle = t.path().join("mod1.bundle.js");
|
||||||
|
let mut deno = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("bundle")
|
||||||
|
.arg("--cert")
|
||||||
|
.arg(cafile)
|
||||||
|
.arg(mod1)
|
||||||
|
.arg(&bundle)
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to spawn script");
|
||||||
|
let status = deno.wait().expect("failed to wait for the child process");
|
||||||
|
assert!(status.success());
|
||||||
|
assert!(bundle.is_file());
|
||||||
|
|
||||||
|
// Now we try to use that bundle from another module.
|
||||||
|
let test = t.path().join("test.js");
|
||||||
|
std::fs::write(
|
||||||
|
&test,
|
||||||
|
"
|
||||||
|
import { printHello3 } from \"./mod1.bundle.js\";
|
||||||
|
printHello3(); ",
|
||||||
|
)
|
||||||
|
.expect("error writing file");
|
||||||
|
|
||||||
|
let output = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--check")
|
||||||
|
.arg(&test)
|
||||||
|
.output()
|
||||||
|
.expect("failed to spawn script");
|
||||||
|
// check the output of the test.ts program.
|
||||||
|
assert!(std::str::from_utf8(&output.stdout)
|
||||||
|
.unwrap()
|
||||||
|
.trim()
|
||||||
|
.ends_with("Hello"));
|
||||||
|
assert_eq!(output.stderr, b"");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn listen_tls_alpn() {
|
||||||
|
// TLS streams require the presence of an ambient local task set to gracefully
|
||||||
|
// close dropped connections in the background.
|
||||||
|
LocalSet::new()
|
||||||
|
.run_until(async {
|
||||||
|
let mut child = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--unstable")
|
||||||
|
.arg("--quiet")
|
||||||
|
.arg("--allow-net")
|
||||||
|
.arg("--allow-read")
|
||||||
|
.arg("./cert/listen_tls_alpn.ts")
|
||||||
|
.arg("4504")
|
||||||
|
.stdout(std::process::Stdio::piped())
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
let stdout = child.stdout.as_mut().unwrap();
|
||||||
|
let mut msg = [0; 5];
|
||||||
|
let read = stdout.read(&mut msg).unwrap();
|
||||||
|
assert_eq!(read, 5);
|
||||||
|
assert_eq!(&msg, b"READY");
|
||||||
|
|
||||||
|
let mut reader = &mut BufReader::new(Cursor::new(include_bytes!(
|
||||||
|
"../testdata/tls/RootCA.crt"
|
||||||
|
)));
|
||||||
|
let certs = rustls_pemfile::certs(&mut reader).unwrap();
|
||||||
|
let mut root_store = rustls::RootCertStore::empty();
|
||||||
|
root_store.add_parsable_certificates(&certs);
|
||||||
|
let mut cfg = rustls::ClientConfig::builder()
|
||||||
|
.with_safe_defaults()
|
||||||
|
.with_root_certificates(root_store)
|
||||||
|
.with_no_client_auth();
|
||||||
|
cfg.alpn_protocols.push(b"foobar".to_vec());
|
||||||
|
let cfg = Arc::new(cfg);
|
||||||
|
|
||||||
|
let hostname = rustls::ServerName::try_from("localhost").unwrap();
|
||||||
|
|
||||||
|
let tcp_stream = tokio::net::TcpStream::connect("localhost:4504")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let mut tls_stream =
|
||||||
|
TlsStream::new_client_side(tcp_stream, cfg, hostname);
|
||||||
|
|
||||||
|
tls_stream.handshake().await.unwrap();
|
||||||
|
|
||||||
|
let (_, rustls_connection) = tls_stream.get_ref();
|
||||||
|
let alpn = rustls_connection.alpn_protocol().unwrap();
|
||||||
|
assert_eq!(alpn, b"foobar");
|
||||||
|
|
||||||
|
let status = child.wait().unwrap();
|
||||||
|
assert!(status.success());
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn listen_tls_alpn_fail() {
|
||||||
|
// TLS streams require the presence of an ambient local task set to gracefully
|
||||||
|
// close dropped connections in the background.
|
||||||
|
LocalSet::new()
|
||||||
|
.run_until(async {
|
||||||
|
let mut child = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--unstable")
|
||||||
|
.arg("--quiet")
|
||||||
|
.arg("--allow-net")
|
||||||
|
.arg("--allow-read")
|
||||||
|
.arg("./cert/listen_tls_alpn_fail.ts")
|
||||||
|
.arg("4505")
|
||||||
|
.stdout(std::process::Stdio::piped())
|
||||||
|
.spawn()
|
||||||
|
.unwrap();
|
||||||
|
let stdout = child.stdout.as_mut().unwrap();
|
||||||
|
let mut msg = [0; 5];
|
||||||
|
let read = stdout.read(&mut msg).unwrap();
|
||||||
|
assert_eq!(read, 5);
|
||||||
|
assert_eq!(&msg, b"READY");
|
||||||
|
|
||||||
|
let mut reader = &mut BufReader::new(Cursor::new(include_bytes!(
|
||||||
|
"../testdata/tls/RootCA.crt"
|
||||||
|
)));
|
||||||
|
let certs = rustls_pemfile::certs(&mut reader).unwrap();
|
||||||
|
let mut root_store = rustls::RootCertStore::empty();
|
||||||
|
root_store.add_parsable_certificates(&certs);
|
||||||
|
let mut cfg = rustls::ClientConfig::builder()
|
||||||
|
.with_safe_defaults()
|
||||||
|
.with_root_certificates(root_store)
|
||||||
|
.with_no_client_auth();
|
||||||
|
cfg.alpn_protocols.push(b"boofar".to_vec());
|
||||||
|
let cfg = Arc::new(cfg);
|
||||||
|
|
||||||
|
let hostname = rustls::ServerName::try_from("localhost").unwrap();
|
||||||
|
|
||||||
|
let tcp_stream = tokio::net::TcpStream::connect("localhost:4505")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let mut tls_stream =
|
||||||
|
TlsStream::new_client_side(tcp_stream, cfg, hostname);
|
||||||
|
|
||||||
|
tls_stream.handshake().await.unwrap_err();
|
||||||
|
|
||||||
|
let (_, rustls_connection) = tls_stream.get_ref();
|
||||||
|
assert!(rustls_connection.alpn_protocol().is_none());
|
||||||
|
|
||||||
|
let status = child.wait().unwrap();
|
||||||
|
assert!(status.success());
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
}
|
|
@ -1,50 +1,52 @@
|
||||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
use std::process::Command;
|
||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
|
|
||||||
use crate::itest;
|
use crate::itest;
|
||||||
|
|
||||||
use test_util as util;
|
use test_util as util;
|
||||||
|
use util::TempDir;
|
||||||
|
|
||||||
itest!(_095_check_with_bare_import {
|
itest!(_095_check_with_bare_import {
|
||||||
args: "check 095_cache_with_bare_import.ts",
|
args: "check cache/095_cache_with_bare_import.ts",
|
||||||
output: "095_cache_with_bare_import.ts.out",
|
output: "cache/095_cache_with_bare_import.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_extensionless {
|
itest!(check_extensionless {
|
||||||
args: "check --reload http://localhost:4545/subdir/no_js_ext",
|
args: "check --reload http://localhost:4545/subdir/no_js_ext",
|
||||||
output: "cache_extensionless.out",
|
output: "cache/cache_extensionless.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_random_extension {
|
itest!(check_random_extension {
|
||||||
args: "check --reload http://localhost:4545/subdir/no_js_ext@1.0.0",
|
args: "check --reload http://localhost:4545/subdir/no_js_ext@1.0.0",
|
||||||
output: "cache_random_extension.out",
|
output: "cache/cache_random_extension.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_all {
|
itest!(check_all {
|
||||||
args: "check --quiet --remote check_all.ts",
|
args: "check --quiet --remote check/check_all.ts",
|
||||||
output: "check_all.out",
|
output: "check/check_all.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_all_local {
|
itest!(check_all_local {
|
||||||
args: "check --quiet check_all.ts",
|
args: "check --quiet check/check_all.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(module_detection_force {
|
itest!(module_detection_force {
|
||||||
args: "check --quiet module_detection_force.ts",
|
args: "check --quiet check/module_detection_force/main.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Regression test for https://github.com/denoland/deno/issues/14937.
|
// Regression test for https://github.com/denoland/deno/issues/14937.
|
||||||
itest!(declaration_header_file_with_no_exports {
|
itest!(declaration_header_file_with_no_exports {
|
||||||
args: "check --quiet declaration_header_file_with_no_exports.ts",
|
args: "check --quiet check/declaration_header_file_with_no_exports.ts",
|
||||||
output_str: Some(""),
|
output_str: Some(""),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,3 +108,91 @@ fn reload_flag() {
|
||||||
stderr.contains("Check")
|
stderr.contains("Check")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn typecheck_declarations_ns() {
|
||||||
|
let output = util::deno_cmd()
|
||||||
|
.arg("test")
|
||||||
|
.arg("--doc")
|
||||||
|
.arg(util::root_path().join("cli/dts/lib.deno.ns.d.ts"))
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
println!("stdout: {}", String::from_utf8(output.stdout).unwrap());
|
||||||
|
println!("stderr: {}", String::from_utf8(output.stderr).unwrap());
|
||||||
|
assert!(output.status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn typecheck_declarations_unstable() {
|
||||||
|
let output = util::deno_cmd()
|
||||||
|
.arg("test")
|
||||||
|
.arg("--doc")
|
||||||
|
.arg("--unstable")
|
||||||
|
.arg(util::root_path().join("cli/dts/lib.deno.unstable.d.ts"))
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
println!("stdout: {}", String::from_utf8(output.stdout).unwrap());
|
||||||
|
println!("stderr: {}", String::from_utf8(output.stderr).unwrap());
|
||||||
|
assert!(output.status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn typecheck_core() {
|
||||||
|
let deno_dir = TempDir::new();
|
||||||
|
let test_file = deno_dir.path().join("test_deno_core_types.ts");
|
||||||
|
std::fs::write(
|
||||||
|
&test_file,
|
||||||
|
format!(
|
||||||
|
"import \"{}\";",
|
||||||
|
deno_core::resolve_path(
|
||||||
|
util::root_path()
|
||||||
|
.join("core/lib.deno_core.d.ts")
|
||||||
|
.to_str()
|
||||||
|
.unwrap()
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let output = util::deno_cmd_with_deno_dir(&deno_dir)
|
||||||
|
.arg("run")
|
||||||
|
.arg(test_file.to_str().unwrap())
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
println!("stdout: {}", String::from_utf8(output.stdout).unwrap());
|
||||||
|
println!("stderr: {}", String::from_utf8(output.stderr).unwrap());
|
||||||
|
assert!(output.status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ts_no_recheck_on_redirect() {
|
||||||
|
let deno_dir = util::new_deno_dir();
|
||||||
|
let e = util::deno_exe_path();
|
||||||
|
|
||||||
|
let redirect_ts = util::testdata_path().join("run/017_import_redirect.ts");
|
||||||
|
assert!(redirect_ts.is_file());
|
||||||
|
let mut cmd = Command::new(e.clone());
|
||||||
|
cmd.env("DENO_DIR", deno_dir.path());
|
||||||
|
let mut initial = cmd
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--check")
|
||||||
|
.arg(redirect_ts.clone())
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to span script");
|
||||||
|
let status_initial =
|
||||||
|
initial.wait().expect("failed to wait for child process");
|
||||||
|
assert!(status_initial.success());
|
||||||
|
|
||||||
|
let mut cmd = Command::new(e);
|
||||||
|
cmd.env("DENO_DIR", deno_dir.path());
|
||||||
|
let output = cmd
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("run")
|
||||||
|
.arg("--check")
|
||||||
|
.arg(redirect_ts)
|
||||||
|
.output()
|
||||||
|
.expect("failed to spawn script");
|
||||||
|
|
||||||
|
assert!(std::str::from_utf8(&output.stderr).unwrap().is_empty());
|
||||||
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ fn standalone_args() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.arg("a")
|
.arg("a")
|
||||||
.arg("b")
|
.arg("b")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
|
@ -90,7 +90,7 @@ fn standalone_error() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_error.ts")
|
.arg("./compile/standalone_error.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -135,7 +135,7 @@ fn standalone_error_module_with_imports() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_error_module_with_imports_1.ts")
|
.arg("./compile/standalone_error_module_with_imports_1.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -177,7 +177,7 @@ fn standalone_load_datauri() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_import_datauri.ts")
|
.arg("./compile/standalone_import_datauri.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -210,7 +210,7 @@ fn standalone_follow_redirects() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_follow_redirects.ts")
|
.arg("./compile/standalone_follow_redirects.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -244,7 +244,7 @@ fn compile_with_file_exists_error() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&output_path)
|
.arg(&output_path)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -278,7 +278,7 @@ fn compile_with_directory_exists_error() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -312,7 +312,7 @@ fn compile_with_conflict_file_exists_error() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -349,7 +349,7 @@ fn compile_and_overwrite_file() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -364,7 +364,7 @@ fn compile_and_overwrite_file() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./028_args.ts")
|
.arg("./compile/args.ts")
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -390,7 +390,7 @@ fn standalone_runtime_flags() {
|
||||||
.arg("1")
|
.arg("1")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_runtime_flags.ts")
|
.arg("./compile/standalone_runtime_flags.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -426,10 +426,10 @@ fn standalone_import_map() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--allow-read")
|
.arg("--allow-read")
|
||||||
.arg("--import-map")
|
.arg("--import-map")
|
||||||
.arg("standalone_import_map.json")
|
.arg("compile/standalone_import_map.json")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./standalone_import_map.ts")
|
.arg("./compile/standalone_import_map.ts")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -461,7 +461,7 @@ fn skip_rebundle() {
|
||||||
.arg("--unstable")
|
.arg("--unstable")
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("./001_hello.js")
|
.arg("./run/001_hello.js")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.stderr(std::process::Stdio::piped())
|
.stderr(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
|
@ -470,7 +470,7 @@ fn skip_rebundle() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(output.status.success());
|
assert!(output.status.success());
|
||||||
|
|
||||||
//no "Bundle testdata_path/001_hello.js" in output
|
//no "Bundle testdata_path/run/001_hello.js" in output
|
||||||
assert!(!String::from_utf8(output.stderr).unwrap().contains("Bundle"));
|
assert!(!String::from_utf8(output.stderr).unwrap().contains("Bundle"));
|
||||||
|
|
||||||
let output = Command::new(exe)
|
let output = Command::new(exe)
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::itest;
|
||||||
|
|
||||||
itest!(deno_doc_builtin {
|
itest!(deno_doc_builtin {
|
||||||
args: "doc",
|
args: "doc",
|
||||||
output: "deno_doc_builtin.out",
|
output: "doc/deno_doc_builtin.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -19,7 +19,7 @@ fn deno_doc() {
|
||||||
let output = util::deno_cmd_with_deno_dir(&dir)
|
let output = util::deno_cmd_with_deno_dir(&dir)
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(util::testdata_path())
|
||||||
.arg("doc")
|
.arg("doc")
|
||||||
.arg("deno_doc.ts")
|
.arg("doc/deno_doc.ts")
|
||||||
.env("NO_COLOR", "1")
|
.env("NO_COLOR", "1")
|
||||||
.stdout(std::process::Stdio::piped())
|
.stdout(std::process::Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
|
@ -56,8 +56,9 @@ itest!(deno_doc_types_header {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_060_deno_doc_displays_all_overloads_in_details_view {
|
itest!(_060_deno_doc_displays_all_overloads_in_details_view {
|
||||||
args: "doc 060_deno_doc_displays_all_overloads_in_details_view.ts NS.test",
|
args:
|
||||||
output: "060_deno_doc_displays_all_overloads_in_details_view.ts.out",
|
"doc doc/060_deno_doc_displays_all_overloads_in_details_view.ts NS.test",
|
||||||
|
output: "doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(deno_doc_types_header_direct {
|
itest!(deno_doc_types_header_direct {
|
||||||
|
|
|
@ -44,27 +44,27 @@ fn eval_randomness() {
|
||||||
assert!(numbers.len() > 1);
|
assert!(numbers.len() > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
itest!(_029_eval {
|
itest!(eval_basic {
|
||||||
args: "eval console.log(\"hello\")",
|
args: "eval console.log(\"hello\")",
|
||||||
output: "029_eval.out",
|
output_str: Some("hello\n"),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ugly parentheses due to whitespace delimiting problem.
|
// Ugly parentheses due to whitespace delimiting problem.
|
||||||
itest!(_030_eval_ts {
|
itest!(eval_ts {
|
||||||
args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only
|
args: "eval --quiet --ext=ts console.log((123)as(number))", // 'as' is a TS keyword only
|
||||||
output: "030_eval_ts.out",
|
output_str: Some("123\n"),
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_041_dyn_import_eval {
|
itest!(dyn_import_eval {
|
||||||
args: "eval import('./subdir/mod4.js').then(console.log)",
|
args: "eval import('./subdir/mod4.js').then(console.log)",
|
||||||
output: "041_dyn_import_eval.out",
|
output: "eval/dyn_import_eval.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cannot write the expression to evaluate as "console.log(typeof gc)"
|
// Cannot write the expression to evaluate as "console.log(typeof gc)"
|
||||||
// because itest! splits args on whitespace.
|
// because itest! splits args on whitespace.
|
||||||
itest!(v8_flags_eval {
|
itest!(v8_flags_eval {
|
||||||
args: "eval --v8-flags=--expose-gc console.log(typeof(gc))",
|
args: "eval --v8-flags=--expose-gc console.log(typeof(gc))",
|
||||||
output: "v8_flags.js.out",
|
output: "run/v8_flags.js.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(check_local_by_default {
|
itest!(check_local_by_default {
|
||||||
|
|
45
cli/tests/integration/flags_tests.rs
Normal file
45
cli/tests/integration/flags_tests.rs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
|
use crate::itest;
|
||||||
|
use test_util as util;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn help_flag() {
|
||||||
|
let status = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("--help")
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
.wait()
|
||||||
|
.unwrap();
|
||||||
|
assert!(status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn version_short_flag() {
|
||||||
|
let status = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("-V")
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
.wait()
|
||||||
|
.unwrap();
|
||||||
|
assert!(status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn version_long_flag() {
|
||||||
|
let status = util::deno_cmd()
|
||||||
|
.current_dir(util::testdata_path())
|
||||||
|
.arg("--version")
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
.wait()
|
||||||
|
.unwrap();
|
||||||
|
assert!(status.success());
|
||||||
|
}
|
||||||
|
|
||||||
|
itest!(types {
|
||||||
|
args: "types",
|
||||||
|
output: "types/types.out",
|
||||||
|
});
|
|
@ -7,29 +7,29 @@ use test_util::TempDir;
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_test() {
|
fn fmt_test() {
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let fixed_js = util::testdata_path().join("badly_formatted_fixed.js");
|
let testdata_fmt_dir = util::testdata_path().join("fmt");
|
||||||
|
let fixed_js = testdata_fmt_dir.join("badly_formatted_fixed.js");
|
||||||
let badly_formatted_original_js =
|
let badly_formatted_original_js =
|
||||||
util::testdata_path().join("badly_formatted.mjs");
|
testdata_fmt_dir.join("badly_formatted.mjs");
|
||||||
let badly_formatted_js = t.path().join("badly_formatted.js");
|
let badly_formatted_js = t.path().join("badly_formatted.js");
|
||||||
let badly_formatted_js_str = badly_formatted_js.to_str().unwrap();
|
let badly_formatted_js_str = badly_formatted_js.to_str().unwrap();
|
||||||
std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap();
|
std::fs::copy(&badly_formatted_original_js, &badly_formatted_js).unwrap();
|
||||||
|
|
||||||
let fixed_md = util::testdata_path().join("badly_formatted_fixed.md");
|
let fixed_md = testdata_fmt_dir.join("badly_formatted_fixed.md");
|
||||||
let badly_formatted_original_md =
|
let badly_formatted_original_md = testdata_fmt_dir.join("badly_formatted.md");
|
||||||
util::testdata_path().join("badly_formatted.md");
|
|
||||||
let badly_formatted_md = t.path().join("badly_formatted.md");
|
let badly_formatted_md = t.path().join("badly_formatted.md");
|
||||||
let badly_formatted_md_str = badly_formatted_md.to_str().unwrap();
|
let badly_formatted_md_str = badly_formatted_md.to_str().unwrap();
|
||||||
std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap();
|
std::fs::copy(&badly_formatted_original_md, &badly_formatted_md).unwrap();
|
||||||
|
|
||||||
let fixed_json = util::testdata_path().join("badly_formatted_fixed.json");
|
let fixed_json = testdata_fmt_dir.join("badly_formatted_fixed.json");
|
||||||
let badly_formatted_original_json =
|
let badly_formatted_original_json =
|
||||||
util::testdata_path().join("badly_formatted.json");
|
testdata_fmt_dir.join("badly_formatted.json");
|
||||||
let badly_formatted_json = t.path().join("badly_formatted.json");
|
let badly_formatted_json = t.path().join("badly_formatted.json");
|
||||||
let badly_formatted_json_str = badly_formatted_json.to_str().unwrap();
|
let badly_formatted_json_str = badly_formatted_json.to_str().unwrap();
|
||||||
std::fs::copy(&badly_formatted_original_json, &badly_formatted_json).unwrap();
|
std::fs::copy(&badly_formatted_original_json, &badly_formatted_json).unwrap();
|
||||||
// First, check formatting by ignoring the badly formatted file.
|
// First, check formatting by ignoring the badly formatted file.
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(&testdata_fmt_dir)
|
||||||
.arg("fmt")
|
.arg("fmt")
|
||||||
.arg(format!(
|
.arg(format!(
|
||||||
"--ignore={},{},{}",
|
"--ignore={},{},{}",
|
||||||
|
@ -48,7 +48,7 @@ fn fmt_test() {
|
||||||
|
|
||||||
// Check without ignore.
|
// Check without ignore.
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(&testdata_fmt_dir)
|
||||||
.arg("fmt")
|
.arg("fmt")
|
||||||
.arg("--check")
|
.arg("--check")
|
||||||
.arg(badly_formatted_js_str)
|
.arg(badly_formatted_js_str)
|
||||||
|
@ -62,7 +62,7 @@ fn fmt_test() {
|
||||||
|
|
||||||
// Format the source file.
|
// Format the source file.
|
||||||
let status = util::deno_cmd()
|
let status = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(&testdata_fmt_dir)
|
||||||
.arg("fmt")
|
.arg("fmt")
|
||||||
.arg(badly_formatted_js_str)
|
.arg(badly_formatted_js_str)
|
||||||
.arg(badly_formatted_md_str)
|
.arg(badly_formatted_md_str)
|
||||||
|
|
|
@ -8,7 +8,7 @@ use test_util::TempDir;
|
||||||
#[test]
|
#[test]
|
||||||
fn info_with_compiled_source() {
|
fn info_with_compiled_source() {
|
||||||
let _g = util::http_server();
|
let _g = util::http_server();
|
||||||
let module_path = "http://127.0.0.1:4545/048_media_types_jsx.ts";
|
let module_path = "http://127.0.0.1:4545/run/048_media_types_jsx.ts";
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
|
|
||||||
let mut deno = util::deno_cmd()
|
let mut deno = util::deno_cmd()
|
||||||
|
@ -37,79 +37,79 @@ fn info_with_compiled_source() {
|
||||||
assert_eq!(output.stderr, b"");
|
assert_eq!(output.stderr, b"");
|
||||||
}
|
}
|
||||||
|
|
||||||
itest!(_022_info_flag_script {
|
itest!(multiple_imports {
|
||||||
args: "info http://127.0.0.1:4545/019_media_types.ts",
|
args: "info http://127.0.0.1:4545/run/019_media_types.ts",
|
||||||
output: "022_info_flag_script.out",
|
output: "info/multiple_imports.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_031_info_ts_error {
|
itest!(info_ts_error {
|
||||||
args: "info 031_info_ts_error.ts",
|
args: "info info/031_info_ts_error.ts",
|
||||||
output: "031_info_ts_error.out",
|
output: "info/031_info_ts_error.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_041_info_flag {
|
itest!(info_flag {
|
||||||
args: "info",
|
args: "info",
|
||||||
output: "041_info_flag.out",
|
output: "info/041_info_flag.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_042_info_flag_location {
|
itest!(info_flag_location {
|
||||||
args: "info --location https://deno.land",
|
args: "info --location https://deno.land",
|
||||||
output: "041_info_flag_location.out",
|
output: "info/041_info_flag_location.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(info_json {
|
itest!(info_json {
|
||||||
args: "info --json --unstable",
|
args: "info --json --unstable",
|
||||||
output: "info_json.out",
|
output: "info/info_json.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(info_json_location {
|
itest!(info_json_location {
|
||||||
args: "info --json --unstable --location https://deno.land",
|
args: "info --json --unstable --location https://deno.land",
|
||||||
output: "info_json_location.out",
|
output: "info/info_json_location.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_049_info_flag_script_jsx {
|
itest!(info_flag_script_jsx {
|
||||||
args: "info http://127.0.0.1:4545/048_media_types_jsx.ts",
|
args: "info http://127.0.0.1:4545/run/048_media_types_jsx.ts",
|
||||||
output: "049_info_flag_script_jsx.out",
|
output: "info/049_info_flag_script_jsx.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_055_info_file_json {
|
itest!(json_file {
|
||||||
args: "info --quiet --json --unstable 005_more_imports.ts",
|
args: "info --quiet --json --unstable info/json_output/main.ts",
|
||||||
output: "055_info_file_json.out",
|
output: "info/json_output/main.out",
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_065_import_map_info {
|
itest!(import_map_info {
|
||||||
args:
|
args:
|
||||||
"info --quiet --import-map=import_maps/import_map.json import_maps/test.ts",
|
"info --quiet --import-map=import_maps/import_map.json import_maps/test.ts",
|
||||||
output: "065_import_map_info.out",
|
output: "info/065_import_map_info.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_076_info_json_deps_order {
|
itest!(info_json_deps_order {
|
||||||
args: "info --unstable --json 076_info_json_deps_order.ts",
|
args: "info --unstable --json info/076_info_json_deps_order.ts",
|
||||||
output: "076_info_json_deps_order.out",
|
output: "info/076_info_json_deps_order.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(info_missing_module {
|
itest!(info_missing_module {
|
||||||
args: "info error_009_missing_js_module.js",
|
args: "info info/error_009_missing_js_module.js",
|
||||||
output: "info_missing_module.out",
|
output: "info/info_missing_module.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(info_recursive_modules {
|
itest!(info_recursive_modules {
|
||||||
args: "info --quiet info_recursive_imports_test.ts",
|
args: "info --quiet info/info_recursive_imports_test.ts",
|
||||||
output: "info_recursive_imports_test.out",
|
output: "info/info_recursive_imports_test.out",
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(info_type_import {
|
itest!(info_type_import {
|
||||||
args: "info info_type_import.ts",
|
args: "info info/info_type_import.ts",
|
||||||
output: "info_type_import.out",
|
output: "info/info_type_import.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_054_info_local_imports {
|
itest!(_054_info_local_imports {
|
||||||
args: "info --quiet 005_more_imports.ts",
|
args: "info --quiet run/005_more_imports.ts",
|
||||||
output: "054_info_local_imports.out",
|
output: "info/054_info_local_imports.out",
|
||||||
exit_code: 0,
|
exit_code: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -120,13 +120,13 @@ itest!(data_null_error {
|
||||||
output: "info/data_null_error/data_null_error.out",
|
output: "info/data_null_error/data_null_error.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(deno_info_types_header_direct {
|
itest!(types_header_direct {
|
||||||
args: "info --reload type_directives_01.ts",
|
args: "info --reload run/type_directives_01.ts",
|
||||||
output: "info/types_header.out",
|
output: "info/types_header.out",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(deno_info_with_config_override {
|
itest!(with_config_override {
|
||||||
args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json",
|
args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json",
|
||||||
output: "info/with_config/with_config.out",
|
output: "info/with_config/with_config.out",
|
||||||
});
|
});
|
||||||
|
|
|
@ -4107,8 +4107,8 @@ fn lsp_diagnostics_warn_redirect() {
|
||||||
severity: Some(lsp::DiagnosticSeverity::INFORMATION),
|
severity: Some(lsp::DiagnosticSeverity::INFORMATION),
|
||||||
code: Some(lsp::NumberOrString::String("redirect".to_string())),
|
code: Some(lsp::NumberOrString::String("redirect".to_string())),
|
||||||
source: Some("deno".to_string()),
|
source: Some("deno".to_string()),
|
||||||
message: "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/x_deno_warning_redirect.js\".".to_string(),
|
message: "The import of \"http://127.0.0.1:4545/x_deno_warning.js\" was redirected to \"http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js\".".to_string(),
|
||||||
data: Some(json!({"specifier": "http://127.0.0.1:4545/x_deno_warning.js", "redirect": "http://127.0.0.1:4545/x_deno_warning_redirect.js"})),
|
data: Some(json!({"specifier": "http://127.0.0.1:4545/x_deno_warning.js", "redirect": "http://127.0.0.1:4545/lsp/x_deno_warning_redirect.js"})),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -160,9 +160,9 @@ fn pty_complete_expression() {
|
||||||
fn pty_complete_imports() {
|
fn pty_complete_imports() {
|
||||||
util::with_pty(&["repl"], |mut console| {
|
util::with_pty(&["repl"], |mut console| {
|
||||||
// single quotes
|
// single quotes
|
||||||
console.write_line("import './001_hel\t'");
|
console.write_line("import './run/001_hel\t'");
|
||||||
// double quotes
|
// double quotes
|
||||||
console.write_line("import { output } from \"./045_out\t\"");
|
console.write_line("import { output } from \"./run/045_out\t\"");
|
||||||
console.write_line("output('testing output');");
|
console.write_line("output('testing output');");
|
||||||
console.write_line("close();");
|
console.write_line("close();");
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ fn pty_complete_imports() {
|
||||||
// ensure when the directory changes that the suggestions come from the cwd
|
// ensure when the directory changes that the suggestions come from the cwd
|
||||||
util::with_pty(&["repl"], |mut console| {
|
util::with_pty(&["repl"], |mut console| {
|
||||||
console.write_line("Deno.chdir('./subdir');");
|
console.write_line("Deno.chdir('./subdir');");
|
||||||
console.write_line("import '../001_hel\t'");
|
console.write_line("import '../run/001_hel\t'");
|
||||||
console.write_line("close();");
|
console.write_line("close();");
|
||||||
|
|
||||||
let output = console.read_all_output();
|
let output = console.read_all_output();
|
||||||
|
@ -750,7 +750,7 @@ fn eval_flag_runtime_error() {
|
||||||
fn eval_file_flag_valid_input() {
|
fn eval_file_flag_valid_input() {
|
||||||
let (out, err) = util::run_and_collect_output_with_args(
|
let (out, err) = util::run_and_collect_output_with_args(
|
||||||
true,
|
true,
|
||||||
vec!["repl", "--eval-file=./001_hello.js"],
|
vec!["repl", "--eval-file=./run/001_hello.js"],
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
|
@ -789,7 +789,7 @@ fn eval_file_flag_http_input() {
|
||||||
fn eval_file_flag_multiple_files() {
|
fn eval_file_flag_multiple_files() {
|
||||||
let (out, err) = util::run_and_collect_output_with_args(
|
let (out, err) = util::run_and_collect_output_with_args(
|
||||||
true,
|
true,
|
||||||
vec!["repl", "--eval-file=http://127.0.0.1:4545/import_type.ts,./tsc/d.ts,http://127.0.0.1:4545/type_definitions/foo.js"],
|
vec!["repl", "--eval-file=http://127.0.0.1:4545/repl/import_type.ts,./tsc/d.ts,http://127.0.0.1:4545/type_definitions/foo.js"],
|
||||||
Some(vec!["b.method1=v4", "b.method1()+foo.toUpperCase()"]),
|
Some(vec!["b.method1=v4", "b.method1()+foo.toUpperCase()"]),
|
||||||
None,
|
None,
|
||||||
true,
|
true,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -347,6 +347,7 @@ fn existing_import_map_mixed_with_remote() {
|
||||||
.arg("--output")
|
.arg("--output")
|
||||||
.arg("vendor2")
|
.arg("vendor2")
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let output = deno.wait_with_output().unwrap();
|
let output = deno.wait_with_output().unwrap();
|
||||||
|
|
|
@ -242,15 +242,15 @@ fn lint_all_files_on_each_change_test() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_watch_test() {
|
fn fmt_watch_test() {
|
||||||
|
let fmt_testdata_path = util::testdata_path().join("fmt");
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let fixed = util::testdata_path().join("badly_formatted_fixed.js");
|
let fixed = fmt_testdata_path.join("badly_formatted_fixed.js");
|
||||||
let badly_formatted_original =
|
let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs");
|
||||||
util::testdata_path().join("badly_formatted.mjs");
|
|
||||||
let badly_formatted = t.path().join("badly_formatted.js");
|
let badly_formatted = t.path().join("badly_formatted.js");
|
||||||
std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap();
|
std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap();
|
||||||
|
|
||||||
let mut child = util::deno_cmd()
|
let mut child = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(&fmt_testdata_path)
|
||||||
.arg("fmt")
|
.arg("fmt")
|
||||||
.arg(&badly_formatted)
|
.arg(&badly_formatted)
|
||||||
.arg("--watch")
|
.arg("--watch")
|
||||||
|
@ -291,10 +291,10 @@ fn fmt_watch_test() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_watch_without_args_test() {
|
fn fmt_watch_without_args_test() {
|
||||||
|
let fmt_testdata_path = util::testdata_path().join("fmt");
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let fixed = util::testdata_path().join("badly_formatted_fixed.js");
|
let fixed = fmt_testdata_path.join("badly_formatted_fixed.js");
|
||||||
let badly_formatted_original =
|
let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs");
|
||||||
util::testdata_path().join("badly_formatted.mjs");
|
|
||||||
let badly_formatted = t.path().join("badly_formatted.js");
|
let badly_formatted = t.path().join("badly_formatted.js");
|
||||||
std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap();
|
std::fs::copy(&badly_formatted_original, &badly_formatted).unwrap();
|
||||||
|
|
||||||
|
@ -339,15 +339,15 @@ fn fmt_watch_without_args_test() {
|
||||||
#[test]
|
#[test]
|
||||||
fn fmt_check_all_files_on_each_change_test() {
|
fn fmt_check_all_files_on_each_change_test() {
|
||||||
let t = TempDir::new();
|
let t = TempDir::new();
|
||||||
let badly_formatted_original =
|
let fmt_testdata_path = util::testdata_path().join("fmt");
|
||||||
util::testdata_path().join("badly_formatted.mjs");
|
let badly_formatted_original = fmt_testdata_path.join("badly_formatted.mjs");
|
||||||
let badly_formatted_1 = t.path().join("badly_formatted_1.js");
|
let badly_formatted_1 = t.path().join("badly_formatted_1.js");
|
||||||
let badly_formatted_2 = t.path().join("badly_formatted_2.js");
|
let badly_formatted_2 = t.path().join("badly_formatted_2.js");
|
||||||
std::fs::copy(&badly_formatted_original, &badly_formatted_1).unwrap();
|
std::fs::copy(&badly_formatted_original, &badly_formatted_1).unwrap();
|
||||||
std::fs::copy(&badly_formatted_original, &badly_formatted_2).unwrap();
|
std::fs::copy(&badly_formatted_original, &badly_formatted_2).unwrap();
|
||||||
|
|
||||||
let mut child = util::deno_cmd()
|
let mut child = util::deno_cmd()
|
||||||
.current_dir(util::testdata_path())
|
.current_dir(&fmt_testdata_path)
|
||||||
.arg("fmt")
|
.arg("fmt")
|
||||||
.arg(&t.path())
|
.arg(&t.path())
|
||||||
.arg("--watch")
|
.arg("--watch")
|
||||||
|
|
|
@ -41,20 +41,20 @@ itest!(nonexistent_worker {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(_084_worker_custom_inspect {
|
itest!(_084_worker_custom_inspect {
|
||||||
args: "run --allow-read 084_worker_custom_inspect.ts",
|
args: "run --allow-read workers/custom_inspect/main.ts",
|
||||||
output: "084_worker_custom_inspect.ts.out",
|
output: "workers/custom_inspect/main.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(error_worker_permissions_local {
|
itest!(error_worker_permissions_local {
|
||||||
args: "run --reload error_worker_permissions_local.ts",
|
args: "run --reload workers/error_worker_permissions_local.ts",
|
||||||
output: "error_worker_permissions_local.ts.out",
|
output: "workers/error_worker_permissions_local.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(error_worker_permissions_remote {
|
itest!(error_worker_permissions_remote {
|
||||||
args: "run --reload error_worker_permissions_remote.ts",
|
args: "run --reload workers/error_worker_permissions_remote.ts",
|
||||||
http_server: true,
|
http_server: true,
|
||||||
output: "error_worker_permissions_remote.ts.out",
|
output: "workers/error_worker_permissions_remote.ts.out",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
3
cli/tests/testdata/003_relative_import.ts
vendored
3
cli/tests/testdata/003_relative_import.ts
vendored
|
@ -1,3 +0,0 @@
|
||||||
import { printHello } from "./subdir/print_hello.ts";
|
|
||||||
|
|
||||||
printHello();
|
|
9
cli/tests/testdata/014_duplicate_import.ts
vendored
9
cli/tests/testdata/014_duplicate_import.ts
vendored
|
@ -1,9 +0,0 @@
|
||||||
// with all the imports of the same module, the module should only be
|
|
||||||
// instantiated once
|
|
||||||
import "./subdir/auto_print_hello.ts";
|
|
||||||
|
|
||||||
import "./subdir/auto_print_hello.ts";
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await import("./subdir/auto_print_hello.ts");
|
|
||||||
})();
|
|
2
cli/tests/testdata/020_json_modules.ts
vendored
2
cli/tests/testdata/020_json_modules.ts
vendored
|
@ -1,2 +0,0 @@
|
||||||
import config from "./subdir/config.json";
|
|
||||||
console.log(JSON.stringify(config));
|
|
2
cli/tests/testdata/021_mjs_modules.ts
vendored
2
cli/tests/testdata/021_mjs_modules.ts
vendored
|
@ -1,2 +0,0 @@
|
||||||
import { isMod5 } from "./subdir/mod5.mjs";
|
|
||||||
console.log(isMod5);
|
|
2
cli/tests/testdata/023_no_ext
vendored
2
cli/tests/testdata/023_no_ext
vendored
|
@ -1,2 +0,0 @@
|
||||||
import * as mod4 from "./subdir/mod4.js";
|
|
||||||
console.log(mod4.isMod4);
|
|
|
@ -1 +0,0 @@
|
||||||
import "./023_no_ext_with_headers";
|
|
|
@ -1 +0,0 @@
|
||||||
HELLO
|
|
1
cli/tests/testdata/029_eval.out
vendored
1
cli/tests/testdata/029_eval.out
vendored
|
@ -1 +0,0 @@
|
||||||
hello
|
|
1
cli/tests/testdata/030_eval_ts.out
vendored
1
cli/tests/testdata/030_eval_ts.out
vendored
|
@ -1 +0,0 @@
|
||||||
123
|
|
4
cli/tests/testdata/035_cached_only_flag.out
vendored
4
cli/tests/testdata/035_cached_only_flag.out
vendored
|
@ -1,4 +0,0 @@
|
||||||
error: Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified.
|
|
||||||
|
|
||||||
Caused by:
|
|
||||||
Specifier not found in cache: "http://127.0.0.1:4545/019_media_types.ts", --cached-only is specified.
|
|
3
cli/tests/testdata/044_bad_resource.ts
vendored
3
cli/tests/testdata/044_bad_resource.ts
vendored
|
@ -1,3 +0,0 @@
|
||||||
const file = await Deno.open("044_bad_resource.ts", { read: true });
|
|
||||||
file.close();
|
|
||||||
await file.seek(10, 0);
|
|
6
cli/tests/testdata/045_proxy_test.ts.out
vendored
6
cli/tests/testdata/045_proxy_test.ts.out
vendored
|
@ -1,6 +0,0 @@
|
||||||
Proxy server listening on [WILDCARD]
|
|
||||||
Proxy request to: http://localhost:4545/045_mod.ts
|
|
||||||
Proxy request to: http://localhost:4545/045_mod.ts
|
|
||||||
Proxy request to: http://localhost:4545/045_output.ts
|
|
||||||
Proxy request to: http://localhost:4545/045_mod.ts
|
|
||||||
proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
|
|
4
cli/tests/testdata/052_no_remote_flag.out
vendored
4
cli/tests/testdata/052_no_remote_flag.out
vendored
|
@ -1,4 +0,0 @@
|
||||||
error: A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified.
|
|
||||||
|
|
||||||
Caused by:
|
|
||||||
A remote specifier was requested: "http://127.0.0.1:4545/019_media_types.ts", but --no-remote is specified.
|
|
|
@ -1,13 +0,0 @@
|
||||||
import "http://127.0.0.1:4545/053_import_compression/gziped";
|
|
||||||
import "http://127.0.0.1:4545/053_import_compression/brotli";
|
|
||||||
|
|
||||||
console.log(
|
|
||||||
await fetch(
|
|
||||||
"http://127.0.0.1:4545/053_import_compression/gziped",
|
|
||||||
).then((res) => res.text()),
|
|
||||||
);
|
|
||||||
console.log(
|
|
||||||
await fetch(
|
|
||||||
"http://127.0.0.1:4545/053_import_compression/brotli",
|
|
||||||
).then((res) => res.text()),
|
|
||||||
);
|
|
|
@ -1,2 +0,0 @@
|
||||||
const response = await fetch("fetch/hello.txt");
|
|
||||||
console.log(await response.text());
|
|
|
@ -1,4 +0,0 @@
|
||||||
new Worker(
|
|
||||||
import.meta.resolve("./084_worker_custom_inspect_worker.ts"),
|
|
||||||
{ type: "module" },
|
|
||||||
);
|
|
1
cli/tests/testdata/Component.tsx
vendored
1
cli/tests/testdata/Component.tsx
vendored
|
@ -1 +0,0 @@
|
||||||
import "./046_jsx_test.tsx";
|
|
|
@ -1,2 +1,2 @@
|
||||||
[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../
|
[WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../
|
||||||
at file:///[WILDCARD]/error_027_bundle_with_bare_import.ts:[WILDCARD]
|
at file:///[WILDCARD]/error_with_bare_import.ts:[WILDCARD]
|
|
@ -1,4 +1,4 @@
|
||||||
error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'.
|
error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'.
|
||||||
const b: "b" = 12;
|
const b: "b" = 12;
|
||||||
^
|
^
|
||||||
at [WILDCARD]bundle/check_local_by_default2.ts:3:7
|
at [WILDCARD]bundle/check_local_by_default/type_error.ts:3:7
|
|
@ -1,6 +1,6 @@
|
||||||
// deno-lint-ignore-file
|
// deno-lint-ignore-file
|
||||||
|
|
||||||
import { B } from "./subdir/more_decorators.ts";
|
import { B } from "../../subdir/more_decorators.ts";
|
||||||
|
|
||||||
function Decorator() {
|
function Decorator() {
|
||||||
return function (
|
return function (
|
5
cli/tests/testdata/bundle/import_map/import_map.json
vendored
Normal file
5
cli/tests/testdata/bundle/import_map/import_map.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"mod2": "../../subdir/subdir2/mod2.ts"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
[WILDCARD]
|
[WILDCARD]
|
||||||
error: The source code is invalid, as it does not match the expected hash in the lock file.
|
error: The source code is invalid, as it does not match the expected hash in the lock file.
|
||||||
Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts
|
Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts
|
||||||
Lock file: lock_check_err_with_bundle.json
|
Lock file: bundle/lockfile/check_error.json
|
5
cli/tests/testdata/bundle_im.json
vendored
5
cli/tests/testdata/bundle_im.json
vendored
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"imports": {
|
|
||||||
"mod2": "./subdir/subdir2/mod2.ts"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD]
|
||||||
type: TypeScript
|
type: TypeScript
|
||||||
dependencies: 8 unique (total [WILDCARD])
|
dependencies: 8 unique (total [WILDCARD])
|
||||||
|
|
||||||
https://localhost:5545/cafile_info.ts ([WILDCARD])
|
https://localhost:5545/cert/cafile_info.ts ([WILDCARD])
|
||||||
├── https://localhost:5545/subdir/mt_application_ecmascript.j2.js ([WILDCARD])
|
├── https://localhost:5545/subdir/mt_application_ecmascript.j2.js ([WILDCARD])
|
||||||
├── https://localhost:5545/subdir/mt_application_x_javascript.j4.js ([WILDCARD])
|
├── https://localhost:5545/subdir/mt_application_x_javascript.j4.js ([WILDCARD])
|
||||||
├── https://localhost:5545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD])
|
├── https://localhost:5545/subdir/mt_application_x_typescript.t4.ts ([WILDCARD])
|
|
@ -1,3 +1,3 @@
|
||||||
fetch("https://localhost:5545/cafile_ts_fetch.ts.out")
|
fetch("https://localhost:5545/cert/cafile_ts_fetch.ts.out")
|
||||||
.then((r) => r.text())
|
.then((r) => r.text())
|
||||||
.then((t) => console.log(t.trimEnd()));
|
.then((t) => console.log(t.trimEnd()));
|
|
@ -1,4 +1,4 @@
|
||||||
import { assertRejects } from "../../../test_util/std/testing/asserts.ts";
|
import { assertRejects } from "../../../../test_util/std/testing/asserts.ts";
|
||||||
|
|
||||||
const listener = Deno.listenTls({
|
const listener = Deno.listenTls({
|
||||||
port: Number(Deno.args[0]),
|
port: Number(Deno.args[0]),
|
3
cli/tests/testdata/check/module_detection_force.ts
vendored
Normal file
3
cli/tests/testdata/check/module_detection_force.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
const a = 1;
|
||||||
|
await import("./module_detection_force/import.ts");
|
||||||
|
console.log(a);
|
3
cli/tests/testdata/check/module_detection_force/main.ts
vendored
Normal file
3
cli/tests/testdata/check/module_detection_force/main.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
const a = 1;
|
||||||
|
await import("./import.ts");
|
||||||
|
console.log(a);
|
2
cli/tests/testdata/circular1.js
vendored
2
cli/tests/testdata/circular1.js
vendored
|
@ -1,2 +0,0 @@
|
||||||
import "./circular2.js";
|
|
||||||
console.log("circular1");
|
|
2
cli/tests/testdata/circular1.js.out
vendored
2
cli/tests/testdata/circular1.js.out
vendored
|
@ -1,2 +0,0 @@
|
||||||
circular2
|
|
||||||
circular1
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue