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

chore: move test files to testdata directory (#11601)

This commit is contained in:
David Sherret 2021-08-11 10:20:47 -04:00 committed by GitHub
parent a0285e2eb8
commit 15a763152f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1089 changed files with 1150 additions and 1160 deletions

View file

@ -21,10 +21,10 @@
"cli/dts/lib.scripthost.d.ts",
"cli/dts/lib.webworker*.d.ts",
"cli/dts/typescript.d.ts",
"cli/tests/encoding",
"cli/tests/inline_js_source_map*",
"cli/tests/badly_formatted.md",
"cli/tests/badly_formatted.json",
"cli/tests/testdata/encoding",
"cli/tests/testdata/inline_js_source_map*",
"cli/tests/testdata/badly_formatted.md",
"cli/tests/testdata/badly_formatted.json",
"cli/tsc/*typescript.js",
"test_util/std",
"test_util/wpt",

4
.gitattributes vendored
View file

@ -2,11 +2,11 @@
* text=auto eol=lf
*.png -text
/cli/tests/encoding/* -text
/cli/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/symlink_to_subdir symlink=dir
/cli/tests/testdata/symlink_to_subdir symlink=dir
# Tell github these are vendored files.
# Doesn't include them in the language statistics.

View file

@ -36,29 +36,46 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
// invalidating that cache.
(
"cold_hello",
&["run", "--reload", "cli/tests/002_hello.ts"],
&["run", "--reload", "cli/tests/testdata/002_hello.ts"],
None,
),
(
"cold_relative_import",
&["run", "--reload", "cli/tests/003_relative_import.ts"],
&[
"run",
"--reload",
"cli/tests/testdata/003_relative_import.ts",
],
None,
),
("hello", &["run", "cli/tests/002_hello.ts"], None),
("hello", &["run", "cli/tests/testdata/002_hello.ts"], None),
(
"relative_import",
&["run", "cli/tests/003_relative_import.ts"],
&["run", "cli/tests/testdata/003_relative_import.ts"],
None,
),
("error_001", &["run", "cli/tests/error_001.ts"], Some(1)),
(
"error_001",
&["run", "cli/tests/testdata/error_001.ts"],
Some(1),
),
(
"no_check_hello",
&["run", "--reload", "--no-check", "cli/tests/002_hello.ts"],
&[
"run",
"--reload",
"--no-check",
"cli/tests/testdata/002_hello.ts",
],
None,
),
(
"workers_startup",
&["run", "--allow-read", "cli/tests/workers/bench_startup.ts"],
&[
"run",
"--allow-read",
"cli/tests/testdata/workers/bench_startup.ts",
],
None,
),
(
@ -66,7 +83,7 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"run",
"--allow-read",
"cli/tests/workers/bench_round_robin.ts",
"cli/tests/testdata/workers/bench_round_robin.ts",
],
None,
),
@ -75,23 +92,23 @@ const EXEC_TIME_BENCHMARKS: &[(&str, &[&str], Option<i32>)] = &[
&[
"run",
"--allow-read",
"cli/tests/workers/bench_large_message.ts",
"cli/tests/testdata/workers/bench_large_message.ts",
],
None,
),
(
"text_decoder",
&["run", "cli/tests/text_decoder_perf.js"],
&["run", "cli/tests/testdata/text_decoder_perf.js"],
None,
),
(
"text_encoder",
&["run", "cli/tests/text_encoder_perf.js"],
&["run", "cli/tests/testdata/text_encoder_perf.js"],
None,
),
(
"text_encoder_into",
&["run", "cli/tests/text_encoder_into_perf.js"],
&["run", "cli/tests/testdata/text_encoder_into_perf.js"],
None,
),
(

View file

@ -14,7 +14,7 @@ const CLIENT_ADDR: &str = "127.0.0.1 4544";
pub(crate) fn cat(deno_exe: &Path, megs: usize) -> f64 {
let size = megs * MB;
let shell_cmd = format!(
"{} run --allow-read cli/tests/cat.ts /dev/zero | head -c {}",
"{} run --allow-read cli/tests/testdata/cat.ts /dev/zero | head -c {}",
deno_exe.to_str().unwrap(),
size
);
@ -47,12 +47,8 @@ pub(crate) fn tcp(deno_exe: &Path, megs: usize) -> Result<f64> {
// Run deno echo server in the background.
let mut echo_server = Command::new(deno_exe.to_str().unwrap())
.args(&[
"run",
"--allow-net",
"cli/tests/echo_server.ts",
SERVER_ADDR,
])
.args(&["run", "--allow-net", "echo_server.ts", SERVER_ADDR])
.current_dir(test_util::testdata_path())
.spawn()?;
std::thread::sleep(Duration::from_secs(5)); // wait for deno to wake up. TODO racy.

View file

@ -279,12 +279,12 @@ pub struct ConfigFile {
}
impl ConfigFile {
pub fn read(path_str: &str) -> Result<Self, AnyError> {
let path = Path::new(path_str);
pub fn read(path_ref: impl AsRef<Path>) -> Result<Self, AnyError> {
let path = Path::new(path_ref.as_ref());
let config_file = if path.is_absolute() {
path.to_path_buf()
} else {
std::env::current_dir()?.join(path_str)
std::env::current_dir()?.join(path_ref)
};
let config_path = canonicalize_path(&config_file).map_err(|_| {
@ -349,16 +349,15 @@ mod tests {
#[test]
fn read_config_file_relative() {
let config_file = ConfigFile::read("tests/module_graph/tsconfig.json")
let config_file =
ConfigFile::read("tests/testdata/module_graph/tsconfig.json")
.expect("Failed to load config file");
assert!(config_file.json.compiler_options.is_some());
}
#[test]
fn read_config_file_absolute() {
let path = std::env::current_dir()
.unwrap()
.join("tests/module_graph/tsconfig.json");
let path = test_util::testdata_path().join("module_graph/tsconfig.json");
let config_file = ConfigFile::read(path.to_str().unwrap())
.expect("Failed to load config file");
assert!(config_file.json.compiler_options.is_some());

View file

@ -663,8 +663,7 @@ mod tests {
charset: &str,
expected: &str,
) {
let url_str =
format!("http://127.0.0.1:4545/cli/tests/encoding/{}", fixture);
let url_str = format!("http://127.0.0.1:4545/encoding/{}", fixture);
let specifier = resolve_url(&url_str).unwrap();
let (file, headers) = test_fetch_remote(&specifier).await;
assert_eq!(file.source, expected);
@ -676,8 +675,7 @@ mod tests {
}
async fn test_fetch_local_encoded(charset: &str, expected: String) {
let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join(format!("tests/encoding/{}.ts", charset));
let p = test_util::testdata_path().join(format!("encoding/{}.ts", charset));
let specifier = resolve_url_or_path(p.to_str().unwrap()).unwrap();
let (file, _) = test_fetch(&specifier).await;
assert_eq!(file.source, expected);
@ -910,9 +908,8 @@ mod tests {
async fn test_get_source() {
let _http_server_guard = test_util::http_server();
let (file_fetcher, _) = setup(CacheSetting::Use, None);
let specifier = resolve_url(
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js",
)
let specifier =
resolve_url("http://localhost:4548/subdir/redirects/redirect1.js")
.unwrap();
let result = file_fetcher
@ -926,9 +923,7 @@ mod tests {
assert_eq!(file.source, "export const redirect = 1;\n");
assert_eq!(
file.specifier,
resolve_url(
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js"
)
resolve_url("http://localhost:4545/subdir/redirects/redirect1.js")
.unwrap()
);
}
@ -999,8 +994,7 @@ mod tests {
let (file_fetcher_01, _) = setup(CacheSetting::Use, Some(temp_dir.clone()));
let (file_fetcher_02, _) = setup(CacheSetting::Use, Some(temp_dir.clone()));
let specifier =
resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts")
.unwrap();
resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap();
let result = file_fetcher
.fetch(&specifier, &mut Permissions::allow_all())
@ -1098,8 +1092,7 @@ mod tests {
)
.expect("could not create file fetcher");
let specifier =
resolve_url("http://localhost:4545/cli/tests/subdir/mismatch_ext.ts")
.unwrap();
resolve_url("http://localhost:4545/subdir/mismatch_ext.ts").unwrap();
let cache_filename = file_fetcher_01
.http_cache
.get_cache_filename(&specifier)
@ -1148,17 +1141,15 @@ mod tests {
async fn test_fetch_redirected() {
let _http_server_guard = test_util::http_server();
let (file_fetcher, _) = setup(CacheSetting::Use, None);
let specifier = resolve_url(
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js",
)
let specifier =
resolve_url("http://localhost:4546/subdir/redirects/redirect1.js")
.unwrap();
let cached_filename = file_fetcher
.http_cache
.get_cache_filename(&specifier)
.unwrap();
let redirected_specifier = resolve_url(
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js",
)
let redirected_specifier =
resolve_url("http://localhost:4545/subdir/redirects/redirect1.js")
.unwrap();
let redirected_cached_filename = file_fetcher
.http_cache
@ -1183,7 +1174,7 @@ mod tests {
.expect("could not get file");
assert_eq!(
headers.get("location").unwrap(),
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js"
"http://localhost:4545/subdir/redirects/redirect1.js"
);
assert_eq!(
@ -1201,25 +1192,22 @@ mod tests {
async fn test_fetch_multiple_redirects() {
let _http_server_guard = test_util::http_server();
let (file_fetcher, _) = setup(CacheSetting::Use, None);
let specifier = resolve_url(
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js",
)
let specifier =
resolve_url("http://localhost:4548/subdir/redirects/redirect1.js")
.unwrap();
let cached_filename = file_fetcher
.http_cache
.get_cache_filename(&specifier)
.unwrap();
let redirected_01_specifier = resolve_url(
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js",
)
let redirected_01_specifier =
resolve_url("http://localhost:4546/subdir/redirects/redirect1.js")
.unwrap();
let redirected_01_cached_filename = file_fetcher
.http_cache
.get_cache_filename(&redirected_01_specifier)
.unwrap();
let redirected_02_specifier = resolve_url(
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js",
)
let redirected_02_specifier =
resolve_url("http://localhost:4545/subdir/redirects/redirect1.js")
.unwrap();
let redirected_02_cached_filename = file_fetcher
.http_cache
@ -1244,7 +1232,7 @@ mod tests {
.expect("could not get file");
assert_eq!(
headers.get("location").unwrap(),
"http://localhost:4546/cli/tests/subdir/redirects/redirect1.js"
"http://localhost:4546/subdir/redirects/redirect1.js"
);
assert_eq!(
@ -1258,7 +1246,7 @@ mod tests {
.expect("could not get file");
assert_eq!(
headers.get("location").unwrap(),
"http://localhost:4545/cli/tests/subdir/redirects/redirect1.js"
"http://localhost:4545/subdir/redirects/redirect1.js"
);
assert_eq!(
@ -1289,11 +1277,9 @@ mod tests {
)
.expect("could not create file fetcher");
let specifier =
resolve_url("http://localhost:4548/cli/tests/subdir/mismatch_ext.ts")
.unwrap();
resolve_url("http://localhost:4548/subdir/mismatch_ext.ts").unwrap();
let redirected_specifier =
resolve_url("http://localhost:4546/cli/tests/subdir/mismatch_ext.ts")
.unwrap();
resolve_url("http://localhost:4546/subdir/mismatch_ext.ts").unwrap();
let redirected_cache_filename = file_fetcher_01
.http_cache
.get_cache_filename(&redirected_specifier)
@ -1342,9 +1328,8 @@ mod tests {
async fn test_fetcher_limits_redirects() {
let _http_server_guard = test_util::http_server();
let (file_fetcher, _) = setup(CacheSetting::Use, None);
let specifier = resolve_url(
"http://localhost:4548/cli/tests/subdir/redirects/redirect1.js",
)
let specifier =
resolve_url("http://localhost:4548/subdir/redirects/redirect1.js")
.unwrap();
let result = file_fetcher
@ -1369,16 +1354,15 @@ mod tests {
let _http_server_guard = test_util::http_server();
let (file_fetcher, _) = setup(CacheSetting::Use, None);
let specifier = resolve_url(
"http://localhost:4550/REDIRECT/cli/tests/subdir/redirects/redirect1.js",
"http://localhost:4550/REDIRECT/subdir/redirects/redirect1.js",
)
.unwrap();
let cached_filename = file_fetcher
.http_cache
.get_cache_filename(&specifier)
.unwrap();
let redirected_specifier = resolve_url(
"http://localhost:4550/cli/tests/subdir/redirects/redirect1.js",
)
let redirected_specifier =
resolve_url("http://localhost:4550/subdir/redirects/redirect1.js")
.unwrap();
let redirected_cached_filename = file_fetcher
.http_cache
@ -1403,7 +1387,7 @@ mod tests {
.expect("could not get file");
assert_eq!(
headers.get("location").unwrap(),
"/cli/tests/subdir/redirects/redirect1.js"
"/subdir/redirects/redirect1.js"
);
assert_eq!(
@ -1431,8 +1415,7 @@ mod tests {
None,
)
.expect("could not create file fetcher");
let specifier =
resolve_url("http://localhost:4545/cli/tests/002_hello.ts").unwrap();
let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap();
let result = file_fetcher
.fetch(&specifier, &mut Permissions::allow_all())
@ -1440,7 +1423,7 @@ mod tests {
assert!(result.is_err());
let err = result.unwrap_err();
assert_eq!(get_custom_error_class(&err), Some("NoRemote"));
assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/cli/tests/002_hello.ts\", but --no-remote is specified.");
assert_eq!(err.to_string(), "A remote specifier was requested: \"http://localhost:4545/002_hello.ts\", but --no-remote is specified.");
}
#[tokio::test]
@ -1468,8 +1451,7 @@ mod tests {
None,
)
.expect("could not create file fetcher");
let specifier =
resolve_url("http://localhost:4545/cli/tests/002_hello.ts").unwrap();
let specifier = resolve_url("http://localhost:4545/002_hello.ts").unwrap();
let result = file_fetcher_01
.fetch(&specifier, &mut Permissions::allow_all())
@ -1477,7 +1459,7 @@ mod tests {
assert!(result.is_err());
let err = result.unwrap_err();
assert_eq!(get_custom_error_class(&err), Some("NotFound"));
assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/cli/tests/002_hello.ts\", --cached-only is specified.");
assert_eq!(err.to_string(), "Specifier not found in cache: \"http://localhost:4545/002_hello.ts\", --cached-only is specified.");
let result = file_fetcher_02
.fetch(&specifier, &mut Permissions::allow_all())

View file

@ -234,8 +234,8 @@ mod tests {
assert!(!is_supported_ext(Path::new("tests/subdir/redirects")));
assert!(!is_supported_ext(Path::new("README.md")));
assert!(is_supported_ext(Path::new("lib/typescript.d.ts")));
assert!(is_supported_ext(Path::new("cli/tests/001_hello.js")));
assert!(is_supported_ext(Path::new("cli/tests/002_hello.ts")));
assert!(is_supported_ext(Path::new("testdata/001_hello.js")));
assert!(is_supported_ext(Path::new("testdata/002_hello.ts")));
assert!(is_supported_ext(Path::new("foo.jsx")));
assert!(is_supported_ext(Path::new("foo.tsx")));
assert!(is_supported_ext(Path::new("foo.TS")));
@ -252,8 +252,8 @@ mod tests {
assert!(is_supported_ext_fmt(Path::new("README.md")));
assert!(is_supported_ext_fmt(Path::new("readme.MD")));
assert!(is_supported_ext_fmt(Path::new("lib/typescript.d.ts")));
assert!(is_supported_ext_fmt(Path::new("cli/tests/001_hello.js")));
assert!(is_supported_ext_fmt(Path::new("cli/tests/002_hello.ts")));
assert!(is_supported_ext_fmt(Path::new("testdata/001_hello.js")));
assert!(is_supported_ext_fmt(Path::new("testdata/002_hello.ts")));
assert!(is_supported_ext_fmt(Path::new("foo.jsx")));
assert!(is_supported_ext_fmt(Path::new("foo.tsx")));
assert!(is_supported_ext_fmt(Path::new("foo.TS")));

View file

@ -152,8 +152,7 @@ mod tests {
async fn test_fetch_string() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url =
Url::parse("http://127.0.0.1:4545/cli/tests/fixture.json").unwrap();
let url = Url::parse("http://127.0.0.1:4545/fixture.json").unwrap();
let client = create_test_client(None);
let result = fetch_once(FetchOnceArgs {
client,
@ -176,9 +175,7 @@ mod tests {
async fn test_fetch_gzip() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url = Url::parse(
"http://127.0.0.1:4545/cli/tests/053_import_compression/gziped",
)
let url = Url::parse("http://127.0.0.1:4545/053_import_compression/gziped")
.unwrap();
let client = create_test_client(None);
let result = fetch_once(FetchOnceArgs {
@ -239,9 +236,7 @@ mod tests {
async fn test_fetch_brotli() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url = Url::parse(
"http://127.0.0.1:4545/cli/tests/053_import_compression/brotli",
)
let url = Url::parse("http://127.0.0.1:4545/053_import_compression/brotli")
.unwrap();
let client = create_test_client(None);
let result = fetch_once(FetchOnceArgs {
@ -269,11 +264,9 @@ mod tests {
async fn test_fetch_once_with_redirect() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url =
Url::parse("http://127.0.0.1:4546/cli/tests/fixture.json").unwrap();
let url = Url::parse("http://127.0.0.1:4546/fixture.json").unwrap();
// Dns resolver substitutes `127.0.0.1` with `localhost`
let target_url =
Url::parse("http://localhost:4545/cli/tests/fixture.json").unwrap();
let target_url = Url::parse("http://localhost:4545/fixture.json").unwrap();
let client = create_test_client(None);
let result = fetch_once(FetchOnceArgs {
client,
@ -331,16 +324,15 @@ mod tests {
async fn test_fetch_with_cafile_string() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url =
Url::parse("https://localhost:5545/cli/tests/fixture.json").unwrap();
let url = Url::parse("https://localhost:5545/fixture.json").unwrap();
let client = create_http_client(
version::get_user_agent(),
None,
Some(
read(
test_util::root_path()
.join("cli/tests/tls/RootCA.pem")
test_util::testdata_path()
.join("tls/RootCA.pem")
.to_str()
.unwrap(),
)
@ -431,17 +423,16 @@ mod tests {
async fn test_fetch_with_cafile_gzip() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url = Url::parse(
"https://localhost:5545/cli/tests/053_import_compression/gziped",
)
let url =
Url::parse("https://localhost:5545/053_import_compression/gziped")
.unwrap();
let client = create_http_client(
version::get_user_agent(),
None,
Some(
read(
test_util::root_path()
.join("cli/tests/tls/RootCA.pem")
test_util::testdata_path()
.join("tls/RootCA.pem")
.to_str()
.unwrap(),
)
@ -480,8 +471,8 @@ mod tests {
None,
Some(
read(
test_util::root_path()
.join("cli/tests/tls/RootCA.pem")
test_util::testdata_path()
.join("tls/RootCA.pem")
.to_str()
.unwrap(),
)
@ -525,17 +516,16 @@ mod tests {
async fn test_fetch_with_cafile_brotli() {
let _http_server_guard = test_util::http_server();
// Relies on external http server. See target/debug/test_server
let url = Url::parse(
"https://localhost:5545/cli/tests/053_import_compression/brotli",
)
let url =
Url::parse("https://localhost:5545/053_import_compression/brotli")
.unwrap();
let client = create_http_client(
version::get_user_agent(),
None,
Some(
read(
test_util::root_path()
.join("cli/tests/tls/RootCA.pem")
test_util::testdata_path()
.join("tls/RootCA.pem")
.to_str()
.unwrap(),
)

View file

@ -575,7 +575,6 @@ mod tests {
use deno_core::resolve_path;
use deno_core::resolve_url;
use deno_core::serde_json::json;
use std::env;
use tempfile::TempDir;
fn setup() -> (Sources, PathBuf) {
@ -588,8 +587,7 @@ mod tests {
#[test]
fn test_sources_get_script_version() {
let (sources, _) = setup();
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let tests = c.join("tests");
let tests = test_util::testdata_path();
let specifier =
resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap();
let actual = sources.get_script_version(&specifier);
@ -599,8 +597,7 @@ mod tests {
#[test]
fn test_sources_get_text() {
let (sources, _) = setup();
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let tests = c.join("tests");
let tests = test_util::testdata_path();
let specifier =
resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap();
let actual = sources.get_source(&specifier);

View file

@ -2069,7 +2069,6 @@ pub mod tests {
use crate::specifier_handler::MemoryHandler;
use deno_core::futures::future;
use deno_core::parking_lot::Mutex;
use std::env;
use std::fs;
use std::path::PathBuf;
@ -2190,8 +2189,7 @@ pub mod tests {
async fn setup(
specifier: ModuleSpecifier,
) -> (Graph, Arc<Mutex<MockSpecifierHandler>>) {
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let fixtures = c.join("tests/module_graph");
let fixtures = test_util::testdata_path().join("module_graph");
let handler = Arc::new(Mutex::new(MockSpecifierHandler {
fixtures,
..MockSpecifierHandler::default()
@ -2314,8 +2312,7 @@ pub mod tests {
("file:///tests/fixture14.ts", "fixture14.out"),
("file:///tests/fixture15.ts", "fixture15.out"),
];
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let fixtures = c.join("tests/bundle");
let fixtures = test_util::testdata_path().join("bundle");
for (specifier, expected_str) in tests {
let specifier = resolve_url_or_path(specifier).unwrap();
@ -2474,8 +2471,10 @@ pub mod tests {
let specifier = resolve_url_or_path("file:///tests/checkwithconfig.ts")
.expect("could not resolve module");
let (graph, handler) = setup(specifier.clone()).await;
let config_file =
ConfigFile::read("tests/module_graph/tsconfig_01.json").unwrap();
let config_file = ConfigFile::read(
test_util::testdata_path().join("module_graph/tsconfig_01.json"),
)
.unwrap();
let result_info = graph
.check(CheckOptions {
debug: false,
@ -2496,8 +2495,10 @@ pub mod tests {
// let's do it all over again to ensure that the versions are determinstic
let (graph, handler) = setup(specifier).await;
let config_file =
ConfigFile::read("tests/module_graph/tsconfig_01.json").unwrap();
let config_file = ConfigFile::read(
test_util::testdata_path().join("module_graph/tsconfig_01.json"),
)
.unwrap();
let result_info = graph
.check(CheckOptions {
debug: false,
@ -2651,8 +2652,7 @@ pub mod tests {
async fn test_graph_import_json() {
let specifier = resolve_url_or_path("file:///tests/importjson.ts")
.expect("could not resolve module");
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let fixtures = c.join("tests/module_graph");
let fixtures = test_util::testdata_path().join("module_graph");
let handler = Arc::new(Mutex::new(MockSpecifierHandler {
fixtures,
..MockSpecifierHandler::default()
@ -2726,8 +2726,10 @@ pub mod tests {
let specifier = resolve_url_or_path("https://deno.land/x/transpile.tsx")
.expect("could not resolve module");
let (mut graph, handler) = setup(specifier).await;
let config_file =
ConfigFile::read("tests/module_graph/tsconfig.json").unwrap();
let config_file = ConfigFile::read(
test_util::testdata_path().join("module_graph/tsconfig.json"),
)
.unwrap();
let result_info = graph
.transpile(TranspileOptions {
debug: false,
@ -2756,8 +2758,7 @@ pub mod tests {
#[tokio::test]
async fn test_graph_import_map_remote_to_local() {
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let fixtures = c.join("tests/module_graph");
let fixtures = test_util::testdata_path().join("module_graph");
let maybe_import_map = Some(
ImportMap::from_json(
"file:///tests/importmap.json",
@ -2783,8 +2784,7 @@ pub mod tests {
#[tokio::test]
async fn test_graph_with_lockfile() {
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let fixtures = c.join("tests/module_graph");
let fixtures = test_util::testdata_path().join("module_graph");
let lockfile_path = fixtures.join("lockfile.json");
let lockfile =
Lockfile::new(lockfile_path, false).expect("could not load lockfile");

View file

@ -572,7 +572,6 @@ pub mod tests {
use crate::http_cache::HttpCache;
use deno_core::resolve_url_or_path;
use deno_runtime::deno_web::BlobStore;
use std::env;
use tempfile::TempDir;
macro_rules! map (
@ -618,8 +617,7 @@ pub mod tests {
let _http_server_guard = test_util::http_server();
let (_, mut file_fetcher) = setup();
let specifier =
resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts")
.unwrap();
resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap();
let cached_module: CachedModule = file_fetcher
.fetch(specifier.clone(), None, false)
.await
@ -639,8 +637,7 @@ pub mod tests {
let _http_server_guard = test_util::http_server();
let (_, mut file_fetcher) = setup();
let specifier =
resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts")
.unwrap();
resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap();
let cached_module: CachedModule = file_fetcher
.fetch(specifier.clone(), None, false)
.await
@ -665,14 +662,16 @@ pub mod tests {
let _http_server_guard = test_util::http_server();
let (_, mut file_fetcher) = setup();
let specifier =
resolve_url_or_path("http://localhost:4545/cli/tests/subdir/mod2.ts")
.unwrap();
resolve_url_or_path("http://localhost:4545/subdir/mod2.ts").unwrap();
let cached_module: CachedModule =
file_fetcher.fetch(specifier, None, false).await.unwrap();
assert!(cached_module.is_remote);
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let specifier = resolve_url_or_path(
c.join("tests/subdir/mod1.ts").as_os_str().to_str().unwrap(),
test_util::testdata_path()
.join("subdir/mod1.ts")
.as_os_str()
.to_str()
.unwrap(),
)
.unwrap();
let cached_module: CachedModule =

View file

@ -1,3 +0,0 @@
import { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts";
printHello();
console.log("success");

View file

@ -1,24 +0,0 @@
// When run against the test HTTP server, it will serve different media types
// based on the URL containing `.t#.` strings, which exercises the different
// mapping of media types end to end.
import { loaded as loadedTs1 } from "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts";
import { loaded as loadedTs2 } from "http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts";
import { loaded as loadedTs3 } from "http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts";
import { loaded as loadedTs4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts";
import { loaded as loadedJs1 } from "http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js";
import { loaded as loadedJs2 } from "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js";
import { loaded as loadedJs3 } from "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js";
import { loaded as loadedJs4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js";
console.log(
"success",
loadedTs1,
loadedTs2,
loadedTs3,
loadedTs4,
loadedJs1,
loadedJs2,
loadedJs3,
loadedJs4,
);

View file

@ -1,14 +0,0 @@
[WILDCARD]
local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD]
type: TypeScript
dependencies: 8 unique (total [WILDCARD])
http://127.0.0.1:4545/cli/tests/019_media_types.ts ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts ([WILDCARD])
└── http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts ([WILDCARD])

View file

@ -1 +0,0 @@
error: Specifier not found in cache: "http://127.0.0.1:4545/cli/tests/019_media_types.ts", --cached-only is specified.

View file

@ -1,5 +0,0 @@
Download http://localhost:4545/cli/tests/subdir/mod2.ts
Download http://localhost:4545/cli/tests/subdir/print_hello.ts
Check [WILDCARD]/fetch/test.ts
Download http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts
Check [WILDCARD]/fetch/other.ts

View file

@ -1,6 +0,0 @@
Proxy server listening on [WILDCARD]
Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts
Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts
Proxy request to: http://localhost:4545/test_util/std/fmt/colors.ts
Proxy request to: http://localhost:4545/test_util/std/examples/colors.ts
proxy-authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

View file

@ -1,32 +0,0 @@
// When run against the test HTTP server, it will serve different media types
// based on the URL containing `.t#.` strings, which exercises the different
// mapping of media types end to end.
import { loaded as loadedTsx1 } from "http://localhost:4545/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx";
import { loaded as loadedTsx2 } from "http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx";
import { loaded as loadedTsx3 } from "http://localhost:4545/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx";
import { loaded as loadedTsx4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx";
import { loaded as loadedJsx1 } from "http://localhost:4545/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx";
import { loaded as loadedJsx2 } from "http://localhost:4545/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx";
import { loaded as loadedJsx3 } from "http://localhost:4545/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx";
import { loaded as loadedJsx4 } from "http://localhost:4545/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx";
declare global {
namespace JSX {
interface IntrinsicElements {
// deno-lint-ignore no-explicit-any
[elemName: string]: any;
}
}
}
console.log(
"success",
loadedTsx1,
loadedTsx2,
loadedTsx3,
loadedTsx4,
loadedJsx1,
loadedJsx2,
loadedJsx3,
loadedJsx4,
);

View file

@ -1,14 +0,0 @@
[WILDCARD]
local: [WILDCARD]http[WILDCARD]127.0.0.1_PORT4545[WILDCARD]
type: TypeScript
dependencies: 8 unique (total [WILDCARD])
http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx ([WILDCARD])
├── http://localhost:4545/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx ([WILDCARD])
└── http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx ([WILDCARD])

View file

@ -1,13 +0,0 @@
import "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped";
import "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli";
console.log(
await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/gziped",
).then((res) => res.text()),
);
console.log(
await fetch(
"http://127.0.0.1:4545/cli/tests/053_import_compression/brotli",
).then((res) => res.text()),
);

View file

@ -1,12 +0,0 @@
Defined in [WILDCARD]/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:3:2
function test(name: string, fn: Function): void
Defined in [WILDCARD]/cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:4:2
function test(options: object): void
Defined in [WILDCARD]cli/tests/060_deno_doc_displays_all_overloads_in_details_view.ts:5:2
function test(name: string | object, fn?: Function): void

View file

@ -1,3 +0,0 @@
# Integration Tests
This path contains integration tests. See integration_tests.rs for the index.

View file

@ -1,3 +0,0 @@
const mod1 = await import("http://localhost:4545/cli/tests/subdir/mod1.ts");
mod1.printHello3();

View file

@ -1,2 +0,0 @@
[WILDCARD]
Check http://localhost:4545/cli/tests/subdir/no_js_ext

View file

@ -1,2 +0,0 @@
[WILDCARD]
Check http://localhost:4545/cli/tests/subdir/no_js_ext@1.0.0

View file

@ -1,24 +0,0 @@
// When run against the test HTTP server, it will serve different media types
// based on the URL containing `.t#.` strings, which exercises the different
// mapping of media types end to end.
import { loaded as loadedTs1 } from "https://localhost:5545/cli/tests/subdir/mt_text_typescript.t1.ts";
import { loaded as loadedTs2 } from "https://localhost:5545/cli/tests/subdir/mt_video_vdn.t2.ts";
import { loaded as loadedTs3 } from "https://localhost:5545/cli/tests/subdir/mt_video_mp2t.t3.ts";
import { loaded as loadedTs4 } from "https://localhost:5545/cli/tests/subdir/mt_application_x_typescript.t4.ts";
import { loaded as loadedJs1 } from "https://localhost:5545/cli/tests/subdir/mt_text_javascript.j1.js";
import { loaded as loadedJs2 } from "https://localhost:5545/cli/tests/subdir/mt_application_ecmascript.j2.js";
import { loaded as loadedJs3 } from "https://localhost:5545/cli/tests/subdir/mt_text_ecmascript.j3.js";
import { loaded as loadedJs4 } from "https://localhost:5545/cli/tests/subdir/mt_application_x_javascript.j4.js";
console.log(
"success",
loadedTs1,
loadedTs2,
loadedTs3,
loadedTs4,
loadedJs1,
loadedJs2,
loadedJs3,
loadedJs4,
);

View file

@ -1,13 +0,0 @@
local: [WILDCARD]https[WILDCARD]localhost_PORT5545[WILDCARD]
type: TypeScript
dependencies: 8 unique (total [WILDCARD])
https://localhost:5545/cli/tests/cafile_info.ts ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_application_ecmascript.j2.js ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_application_x_javascript.j4.js ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_application_x_typescript.t4.ts ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_text_ecmascript.j3.js ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_text_javascript.j1.js ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_text_typescript.t1.ts ([WILDCARD])
├── https://localhost:5545/cli/tests/subdir/mt_video_mp2t.t3.ts ([WILDCARD])
└── https://localhost:5545/cli/tests/subdir/mt_video_vdn.t2.ts ([WILDCARD])

View file

@ -1,3 +0,0 @@
import { printHello } from "https://localhost:5545/cli/tests/subdir/mod2.ts";
printHello();
console.log("success");

View file

@ -1,7 +0,0 @@
{
"compilerOptions": {
"types": [
"http://localhost:4545/cli/tests/subdir/types.d.ts"
]
}
}

View file

@ -1,3 +0,0 @@
error: Modules imported via https are not allowed to import http modules.
Importing: http://localhost:4545/cli/tests/001_hello.js
at https://localhost:5545/cli/tests/disallow_http_from_https.js:2:0

View file

@ -1,3 +0,0 @@
error: Modules imported via https are not allowed to import http modules.
Importing: http://localhost:4545/cli/tests/001_hello.js
at https://localhost:5545/cli/tests/disallow_http_from_https.ts:2:0

View file

@ -1,3 +0,0 @@
await import(
"http://localhost:4545/cli/tests/dynamic_import/static_remote.ts"
);

View file

@ -1,5 +0,0 @@
error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag
at http://localhost:4545/cli/tests/dynamic_import/static_remote.ts:2:0
await import(
^
at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_remote_remote.ts:1:1

View file

@ -1,6 +0,0 @@
[WILDCARD]error: Uncaught Error: bad
throw Error("bad");
^
at foo ([WILDCARD]tests/error_001.ts:2:9)
at bar ([WILDCARD]tests/error_001.ts:6:3)
at [WILDCARD]tests/error_001.ts:9:1

View file

@ -1,6 +0,0 @@
[WILDCARD]error: Uncaught Error: exception from mod1
throw Error("exception from mod1");
^
at throwsError ([WILDCARD]tests/subdir/mod1.ts:16:9)
at foo ([WILDCARD]tests/error_002.ts:4:3)
at [WILDCARD]tests/error_002.ts:7:1

View file

@ -1,2 +0,0 @@
[WILDCARD]error: Cannot resolve module "file:///[WILDCARD]cli/tests/bad-module.ts" from "file:///[WILDCARD]cli/tests/error_004_missing_module.ts".
at file:///[WILDCARD]cli/tests/error_004_missing_module.ts:1:0

View file

@ -1,3 +0,0 @@
(async () => {
await import("http://localhost:4545/cli/tests/subdir/mod4.js");
})();

View file

@ -1,8 +0,0 @@
[WILDCARD]Error: function
at foo ([WILDCARD]tests/error_019_stack_function.ts:[WILDCARD])
at [WILDCARD]tests/error_019_stack_function.ts:[WILDCARD]
error: Uncaught Error: function
throw new Error("function");
^
at foo ([WILDCARD]tests/error_019_stack_function.ts:[WILDCARD])
at [WILDCARD]tests/error_019_stack_function.ts:[WILDCARD]

View file

@ -1,8 +0,0 @@
[WILDCARD]Error: constructor
at new A ([WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD])
at [WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD]
error: Uncaught Error: constructor
throw new Error("constructor");
^
at new A ([WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD])
at [WILDCARD]tests/error_020_stack_constructor.ts:[WILDCARD]

View file

@ -1,8 +0,0 @@
[WILDCARD]Error: method
at A.m ([WILDCARD]tests/error_021_stack_method.ts:[WILDCARD])
at [WILDCARD]tests/error_021_stack_method.ts:[WILDCARD]
error: Uncaught Error: method
throw new Error("method");
^
at A.m ([WILDCARD]tests/error_021_stack_method.ts:[WILDCARD])
at [WILDCARD]tests/error_021_stack_method.ts:[WILDCARD]

View file

@ -1,6 +0,0 @@
[WILDCARD]CustomError: custom error
at [WILDCARD]tests/error_022_stack_custom_error.ts:[WILDCARD]
error: Uncaught CustomError: custom error
const error = new CustomError();
^
at [WILDCARD]tests/error_022_stack_custom_error.ts:[WILDCARD]

View file

@ -1,10 +0,0 @@
[WILDCARD]Error: async
at [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]
error: Uncaught Error: async
throw new Error("async");
^
at [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]
at async [WILDCARD]tests/error_023_stack_async.ts:[WILDCARD]

View file

@ -1,10 +0,0 @@
[WILDCARD]Error: Promise.all()
at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD]
at async Promise.all (index 1)
at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD]
error: Uncaught Error: Promise.all()
throw new Error("Promise.all()");
^
at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD]
at async Promise.all (index 1)
at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD]

View file

@ -1,6 +0,0 @@
[WILDCARD]error: Uncaught Error: bad
throw Error("bad");
^
at foo ([WILDCARD]tests/error_025_tab_indent:2:8)
at bar ([WILDCARD]tests/error_025_tab_indent:6:2)
at [WILDCARD]tests/error_025_tab_indent:9:1

View file

@ -1 +0,0 @@
import "http://localhost:4545/cli/tests/error_001.ts";

View file

@ -1,7 +0,0 @@
[WILDCARD]error: Uncaught Error: bad
throw Error("bad");
^
at foo (http://localhost:4545/cli/tests/error_001.ts:2:9)
at bar (http://localhost:4545/cli/tests/error_001.ts:6:3)
at http://localhost:4545/cli/tests/error_001.ts:9:1
[WILDCARD]

View file

@ -1,2 +0,0 @@
error: Cannot resolve module "[WILDCARD]cli/tests/does_not_exist.js" from "[WILDCARD]cli/tests/error_missing_module_named_import.ts".
at [WILDCARD]cli/tests/error_missing_module_named_import.ts:1:0

View file

@ -1 +0,0 @@
error: Expected ,, got following at [WILDCARD]tests/error_syntax.js:3:5

View file

@ -1 +0,0 @@
error: Unexpected eof at [WILDCARD]tests/error_syntax_empty_trailing_line.mjs:2:21

View file

@ -1,4 +0,0 @@
new Worker(
"http://localhost:4545/cli/tests/subdir/worker_types.ts",
{ type: "module" },
);

View file

@ -1 +0,0 @@
import "http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts";

View file

@ -1 +0,0 @@
import "http://localhost:4545/cli/tests/subdir/mod2.ts";

View file

@ -1,3 +0,0 @@
import { printHello } from "https://localhost:5545/cli/tests/subdir/print_hello.ts";
printHello();

View file

@ -1 +0,0 @@
import "http://localhost:4545/cli/tests/subdir/file_with_:_in_name.ts";

View file

@ -1,6 +0,0 @@
local: [WILDCARD]error_009_missing_js_module.js
type: JavaScript
dependencies: 1 unique (total 26B)
file://[WILDCARD]/cli/tests/error_009_missing_js_module.js (26B)
└── file://[WILDCARD]/cli/tests/bad-module.js (error)

View file

@ -1,12 +0,0 @@
local: [WILDCARD]info_recursive_imports_test.ts
type: TypeScript
dependencies: 4 unique (total [WILDCARD])
file://[WILDCARD]cli/tests/info_recursive_imports_test.ts ([WILDCARD])
└─┬ file://[WILDCARD]cli/tests/recursive_imports/A.ts ([WILDCARD])
├─┬ file://[WILDCARD]cli/tests/recursive_imports/B.ts ([WILDCARD])
│ ├─┬ file://[WILDCARD]cli/tests/recursive_imports/C.ts ([WILDCARD])
│ │ ├── file://[WILDCARD]cli/tests/recursive_imports/A.ts *
│ │ └── file://[WILDCARD]cli/tests/recursive_imports/common.ts ([WILDCARD])
│ └── file://[WILDCARD]cli/tests/recursive_imports/common.ts *
└── file://[WILDCARD]cli/tests/recursive_imports/common.ts *

View file

@ -1,4 +0,0 @@
"use strict";
1 + 1;
throw new Error("Hello world!");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ==

View file

@ -1,2 +0,0 @@
error: Uncaught Error: Hello world!
at http://localhost:4545/cli/tests/inline_js_source_map_2.ts:6:7

View file

@ -1,4 +0,0 @@
"use strict";
throw new Error("Hello world!");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcF8yLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIjErMTtcbmludGVyZmFjZSBUZXN0IHtcbiAgaGVsbG86IHN0cmluZztcbn1cblxudGhyb3cgbmV3IEVycm9yKFwiSGVsbG8gd29ybGQhXCIgYXMgdW5rbm93biBhcyBzdHJpbmcpO1xuIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxDQUFDLEdBQUMsQ0FBQyxDQUFDO0FBS0osTUFBTSxJQUFJLEtBQUssQ0FBQyxjQUErQixDQUFDLENBQUMifQ==

View file

@ -1,4 +0,0 @@
"use strict";
import "http://localhost:4545/cli/tests/inline_js_source_map.ts";
throw new Error("Hello world!");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHR0cDovL2xvY2FsaG9zdDo0NTQ1L2NsaS90ZXN0cy9pbmxpbmVfanNfc291cmNlX21hcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsQ0FBQyxHQUFDLENBQUMsQ0FBQztBQUtKLE1BQU0sSUFBSSxLQUFLLENBQUMsY0FBK0IsQ0FBQyxDQUFDIn0=

View file

@ -7,12 +7,12 @@ use test_util as util;
#[test]
fn bundle_exports() {
// First we have to generate a bundle of some module that has exports.
let mod1 = util::root_path().join("cli/tests/subdir/mod1.ts");
let mod1 = util::testdata_path().join("subdir/mod1.ts");
assert!(mod1.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("mod1.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(mod1)
.arg(&bundle)
@ -33,7 +33,7 @@ fn bundle_exports() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -49,12 +49,12 @@ fn bundle_exports() {
#[test]
fn bundle_exports_no_check() {
// First we have to generate a bundle of some module that has exports.
let mod1 = util::root_path().join("cli/tests/subdir/mod1.ts");
let mod1 = util::testdata_path().join("subdir/mod1.ts");
assert!(mod1.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("mod1.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg("--no-check")
.arg(mod1)
@ -76,7 +76,7 @@ fn bundle_exports_no_check() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -92,12 +92,12 @@ fn bundle_exports_no_check() {
#[test]
fn bundle_circular() {
// First we have to generate a bundle of some module that has exports.
let circular1 = util::root_path().join("cli/tests/subdir/circular1.ts");
let circular1 = util::testdata_path().join("subdir/circular1.ts");
assert!(circular1.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("circular1.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(circular1)
.arg(&bundle)
@ -108,7 +108,7 @@ fn bundle_circular() {
assert!(bundle.is_file());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&bundle)
.output()
@ -124,13 +124,12 @@ fn bundle_circular() {
#[test]
fn bundle_single_module() {
// First we have to generate a bundle of some module that has exports.
let single_module =
util::root_path().join("cli/tests/subdir/single_module.ts");
let single_module = util::testdata_path().join("subdir/single_module.ts");
assert!(single_module.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("single_module.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(single_module)
.arg(&bundle)
@ -141,7 +140,7 @@ fn bundle_single_module() {
assert!(bundle.is_file());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&bundle)
.output()
@ -157,12 +156,12 @@ fn bundle_single_module() {
#[test]
fn bundle_tla() {
// First we have to generate a bundle of some module that has exports.
let tla_import = util::root_path().join("cli/tests/subdir/tla.ts");
let tla_import = util::testdata_path().join("subdir/tla.ts");
assert!(tla_import.is_file());
let t = tempfile::TempDir::new().expect("tempdir fail");
let bundle = t.path().join("tla.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(tla_import)
.arg(&bundle)
@ -183,7 +182,7 @@ fn bundle_tla() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -199,12 +198,12 @@ fn bundle_tla() {
#[test]
fn bundle_js() {
// First we have to generate a bundle of some module that has exports.
let mod6 = util::root_path().join("cli/tests/subdir/mod6.js");
let mod6 = util::testdata_path().join("subdir/mod6.js");
assert!(mod6.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("mod6.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(mod6)
.arg(&bundle)
@ -215,7 +214,7 @@ fn bundle_js() {
assert!(bundle.is_file());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&bundle)
.output()
@ -227,13 +226,12 @@ fn bundle_js() {
#[test]
fn bundle_dynamic_import() {
let _g = util::http_server();
let dynamic_import =
util::root_path().join("cli/tests/bundle_dynamic_import.ts");
let dynamic_import = util::testdata_path().join("bundle_dynamic_import.ts");
assert!(dynamic_import.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("bundle_dynamic_import.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(dynamic_import)
.arg(&bundle)
@ -244,7 +242,7 @@ fn bundle_dynamic_import() {
assert!(bundle.is_file());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--allow-net")
.arg("--quiet")
@ -261,13 +259,13 @@ fn bundle_dynamic_import() {
#[test]
fn bundle_import_map() {
let import = util::root_path().join("cli/tests/bundle_im.ts");
let import_map_path = util::root_path().join("cli/tests/bundle_im.json");
let import = util::testdata_path().join("bundle_im.ts");
let import_map_path = util::testdata_path().join("bundle_im.json");
assert!(import.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("import_map.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg("--import-map")
.arg(import_map_path)
@ -290,7 +288,7 @@ fn bundle_import_map() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -305,13 +303,13 @@ fn bundle_import_map() {
#[test]
fn bundle_import_map_no_check() {
let import = util::root_path().join("cli/tests/bundle_im.ts");
let import_map_path = util::root_path().join("cli/tests/bundle_im.json");
let import = util::testdata_path().join("bundle_im.ts");
let import_map_path = util::testdata_path().join("bundle_im.json");
assert!(import.is_file());
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("import_map.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg("--no-check")
.arg("--import-map")
@ -335,7 +333,7 @@ fn bundle_import_map_no_check() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -349,7 +347,7 @@ fn bundle_import_map_no_check() {
}
itest!(lock_check_err_with_bundle {
args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/cli/tests/subdir/mod1.ts",
args: "bundle --lock=lock_check_err_with_bundle.json http://127.0.0.1:4545/subdir/mod1.ts",
output: "lock_check_err_with_bundle.out",
exit_code: 10,
http_server: true,

View file

@ -21,13 +21,13 @@ itest!(_095_cache_with_bare_import {
});
itest!(cache_extensionless {
args: "cache --reload http://localhost:4545/cli/tests/subdir/no_js_ext",
args: "cache --reload http://localhost:4545/subdir/no_js_ext",
output: "cache_extensionless.out",
http_server: true,
});
itest!(cache_random_extension {
args: "cache --reload http://localhost:4545/cli/tests/subdir/no_js_ext@1.0.0",
args: "cache --reload http://localhost:4545/subdir/no_js_ext@1.0.0",
output: "cache_random_extension.out",
http_server: true,
});
@ -39,7 +39,7 @@ itest!(performance_stats {
itest!(redirect_cache {
http_server: true,
args: "cache --reload http://localhost:4548/cli/tests/subdir/redirects/a.ts",
args: "cache --reload http://localhost:4548/subdir/redirects/a.ts",
output: "redirect_cache.out",
});

View file

@ -71,12 +71,12 @@ fn standalone_args() {
dir.path().join("args")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/028_args.ts")
.arg("./028_args.ts")
.arg("a")
.arg("b")
.stdout(std::process::Stdio::piped())
@ -107,12 +107,12 @@ fn standalone_error() {
dir.path().join("error")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/standalone_error.ts")
.arg("./standalone_error.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -143,12 +143,12 @@ fn standalone_no_module_load() {
dir.path().join("hello")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/standalone_import.ts")
.arg("./standalone_import.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -178,12 +178,12 @@ fn standalone_load_datauri() {
dir.path().join("load_datauri")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/standalone_import_datauri.ts")
.arg("./standalone_import_datauri.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -210,12 +210,12 @@ fn standalone_compiler_ops() {
dir.path().join("standalone_compiler_ops")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/standalone_compiler_ops.ts")
.arg("./standalone_compiler_ops.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -243,12 +243,12 @@ fn compile_with_directory_exists_error() {
};
std::fs::create_dir(&exe).expect("cannot create directory");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/028_args.ts")
.arg("./028_args.ts")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -272,12 +272,12 @@ fn compile_with_conflict_file_exists_error() {
std::fs::write(&exe, b"SHOULD NOT BE OVERWRITTEN")
.expect("cannot create file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/028_args.ts")
.arg("./028_args.ts")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -303,12 +303,12 @@ fn compile_and_overwrite_file() {
dir.path().join("args")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/028_args.ts")
.arg("./028_args.ts")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -318,12 +318,12 @@ fn compile_and_overwrite_file() {
assert!(&exe.exists());
let recompile_output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/028_args.ts")
.arg("./028_args.ts")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -341,7 +341,7 @@ fn standalone_runtime_flags() {
dir.path().join("flags")
};
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("compile")
.arg("--unstable")
.arg("--allow-read")
@ -349,7 +349,7 @@ fn standalone_runtime_flags() {
.arg("1")
.arg("--output")
.arg(&exe)
.arg("./cli/tests/standalone_runtime_flags.ts")
.arg("./standalone_runtime_flags.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()

View file

@ -9,12 +9,12 @@ fn branch() {
let tempdir = TempDir::new().expect("tempdir fail");
let tempdir = tempdir.path().join("cov");
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("test")
.arg("--quiet")
.arg("--unstable")
.arg(format!("--coverage={}", tempdir.to_str().unwrap()))
.arg("cli/tests/coverage/branch_test.ts")
.arg("coverage/branch_test.ts")
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::inherit())
.status()
@ -23,7 +23,7 @@ fn branch() {
assert!(status.success());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("coverage")
.arg("--quiet")
.arg("--unstable")
@ -38,7 +38,7 @@ fn branch() {
.to_string();
let expected = fs::read_to_string(
util::root_path().join("cli/tests/coverage/expected_branch.out"),
util::testdata_path().join("coverage/expected_branch.out"),
)
.unwrap();
@ -51,7 +51,7 @@ fn branch() {
assert!(output.status.success());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("coverage")
.arg("--quiet")
.arg("--unstable")
@ -67,7 +67,7 @@ fn branch() {
.to_string();
let expected = fs::read_to_string(
util::root_path().join("cli/tests/coverage/expected_branch.lcov"),
util::testdata_path().join("coverage/expected_branch.lcov"),
)
.unwrap();
@ -84,12 +84,12 @@ fn branch() {
fn complex() {
let tempdir = TempDir::new().expect("tempdir fail");
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("test")
.arg("--quiet")
.arg("--unstable")
.arg(format!("--coverage={}", tempdir.path().to_str().unwrap()))
.arg("cli/tests/coverage/complex_test.ts")
.arg("coverage/complex_test.ts")
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::inherit())
.status()
@ -98,7 +98,7 @@ fn complex() {
assert!(status.success());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("coverage")
.arg("--quiet")
.arg("--unstable")
@ -113,7 +113,7 @@ fn complex() {
.to_string();
let expected = fs::read_to_string(
util::root_path().join("cli/tests/coverage/expected_complex.out"),
util::testdata_path().join("coverage/expected_complex.out"),
)
.unwrap();
@ -126,7 +126,7 @@ fn complex() {
assert!(output.status.success());
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("coverage")
.arg("--quiet")
.arg("--unstable")
@ -142,7 +142,7 @@ fn complex() {
.to_string();
let expected = fs::read_to_string(
util::root_path().join("cli/tests/coverage/expected_complex.lcov"),
util::testdata_path().join("coverage/expected_complex.lcov"),
)
.unwrap();

View file

@ -7,33 +7,32 @@ use test_util as util;
#[test]
fn fmt_test() {
let t = TempDir::new().expect("tempdir fail");
let fixed_js = util::root_path().join("cli/tests/badly_formatted_fixed.js");
let fixed_js = util::testdata_path().join("badly_formatted_fixed.js");
let badly_formatted_original_js =
util::root_path().join("cli/tests/badly_formatted.mjs");
util::testdata_path().join("badly_formatted.mjs");
let badly_formatted_js = t.path().join("badly_formatted.js");
let badly_formatted_js_str = badly_formatted_js.to_str().unwrap();
std::fs::copy(&badly_formatted_original_js, &badly_formatted_js)
.expect("Failed to copy file");
let fixed_md = util::root_path().join("cli/tests/badly_formatted_fixed.md");
let fixed_md = util::testdata_path().join("badly_formatted_fixed.md");
let badly_formatted_original_md =
util::root_path().join("cli/tests/badly_formatted.md");
util::testdata_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();
std::fs::copy(&badly_formatted_original_md, &badly_formatted_md)
.expect("Failed to copy file");
let fixed_json =
util::root_path().join("cli/tests/badly_formatted_fixed.json");
let fixed_json = util::testdata_path().join("badly_formatted_fixed.json");
let badly_formatted_original_json =
util::root_path().join("cli/tests/badly_formatted.json");
util::testdata_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();
std::fs::copy(&badly_formatted_original_json, &badly_formatted_json)
.expect("Failed to copy file");
// First, check formatting by ignoring the badly formatted file.
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("fmt")
.arg(format!(
"--ignore={},{},{}",
@ -52,7 +51,7 @@ fn fmt_test() {
// Check without ignore.
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("fmt")
.arg("--check")
.arg(badly_formatted_js_str)
@ -66,7 +65,7 @@ fn fmt_test() {
// Format the source file.
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("fmt")
.arg(badly_formatted_js_str)
.arg(badly_formatted_md_str)
@ -91,7 +90,7 @@ fn fmt_test() {
fn fmt_stdin_error() {
use std::io::Write;
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("fmt")
.arg("-")
.stdin(std::process::Stdio::piped())
@ -112,7 +111,7 @@ fn fmt_stdin_error() {
#[test]
fn fmt_ignore_unexplicit_files() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("fmt")
.arg("--check")

View file

@ -7,12 +7,12 @@ use test_util as util;
#[test]
fn info_with_compiled_source() {
let _g = util::http_server();
let module_path = "http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts";
let module_path = "http://127.0.0.1:4545/048_media_types_jsx.ts";
let t = TempDir::new().expect("tempdir fail");
let mut deno = util::deno_cmd()
.env("DENO_DIR", t.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg(&module_path)
.spawn()
@ -23,7 +23,7 @@ fn info_with_compiled_source() {
let output = util::deno_cmd()
.env("DENO_DIR", t.path())
.env("NO_COLOR", "1")
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("info")
.arg(&module_path)
.output()
@ -37,7 +37,7 @@ fn info_with_compiled_source() {
}
itest!(_022_info_flag_script {
args: "info http://127.0.0.1:4545/cli/tests/019_media_types.ts",
args: "info http://127.0.0.1:4545/019_media_types.ts",
output: "022_info_flag_script.out",
http_server: true,
});
@ -68,7 +68,7 @@ itest!(info_json_location {
});
itest!(_049_info_flag_script_jsx {
args: "info http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts",
args: "info http://127.0.0.1:4545/048_media_types_jsx.ts",
output: "049_info_flag_script_jsx.out",
http_server: true,
});

View file

@ -30,7 +30,7 @@ fn extract_ws_url_from_stderr(
#[tokio::test]
async fn inspector_connect() {
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))
@ -64,7 +64,7 @@ enum TestStep {
#[tokio::test]
async fn inspector_break_on_first_line() {
let script = util::tests_path().join("inspector2.js");
let script = util::testdata_path().join("inspector2.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect-brk"))
@ -132,7 +132,7 @@ async fn inspector_break_on_first_line() {
#[tokio::test]
async fn inspector_pause() {
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))
@ -202,7 +202,7 @@ async fn inspector_port_collision() {
return;
}
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let inspect_flag = inspect_flag_with_unique_port("--inspect");
let mut child1 = util::deno_cmd()
@ -242,7 +242,7 @@ async fn inspector_port_collision() {
#[tokio::test]
async fn inspector_does_not_hang() {
let script = util::tests_path().join("inspector3.js");
let script = util::testdata_path().join("inspector3.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect-brk"))
@ -330,7 +330,7 @@ async fn inspector_does_not_hang() {
#[tokio::test]
async fn inspector_without_brk_runs_code() {
let script = util::tests_path().join("inspector4.js");
let script = util::testdata_path().join("inspector4.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))
@ -438,7 +438,7 @@ async fn inspector_runtime_evaluate_does_not_crash() {
#[tokio::test]
async fn inspector_json() {
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))
@ -467,7 +467,7 @@ async fn inspector_json() {
#[tokio::test]
async fn inspector_json_list() {
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))
@ -498,7 +498,7 @@ async fn inspector_json_list() {
async fn inspector_connect_non_ws() {
// https://github.com/denoland/deno/issues/11449
// Verify we don't panic if non-WS connection is being established
let script = util::tests_path().join("inspector1.js");
let script = util::testdata_path().join("inspector1.js");
let mut child = util::deno_cmd()
.arg("run")
.arg(inspect_flag_with_unique_port("--inspect"))

View file

@ -16,7 +16,7 @@ fn installer_test_local_module_run() {
.arg("echo_test")
.arg("--root")
.arg(temp_dir.path())
.arg(util::tests_path().join("echo.ts"))
.arg(util::testdata_path().join("echo.ts"))
.arg("hello")
.spawn()
.unwrap()
@ -47,13 +47,13 @@ fn installer_test_remote_module_run() {
let bin_dir = temp_dir.path().join("bin");
std::fs::create_dir(&bin_dir).unwrap();
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("install")
.arg("--name")
.arg("echo_test")
.arg("--root")
.arg(temp_dir.path())
.arg("http://localhost:4545/cli/tests/echo.ts")
.arg("http://localhost:4545/echo.ts")
.arg("hello")
.spawn()
.unwrap()

View file

@ -12,17 +12,17 @@ use tempfile::TempDir;
use test_util::deno_exe_path;
use test_util::http_server;
use test_util::lsp::LspClient;
use test_util::root_path;
use test_util::testdata_path;
fn load_fixture(path: &str) -> Value {
let fixtures_path = root_path().join("cli/tests/lsp");
let fixtures_path = testdata_path().join("lsp");
let path = fixtures_path.join(path);
let fixture_str = fs::read_to_string(path).unwrap();
serde_json::from_str(&fixture_str).unwrap()
}
fn load_fixture_str(path: &str) -> String {
let fixtures_path = root_path().join("cli/tests/lsp");
let fixtures_path = testdata_path().join("lsp");
let path = fixtures_path.join(path);
fs::read_to_string(path).unwrap()
}
@ -921,7 +921,7 @@ fn lsp_hover_dependency() {
Some(json!({
"contents": {
"kind": "markdown",
"value": "**Resolved Dependency**\n\n**Code**: http&#8203;://127.0.0.1:4545/cli/tests/subdir/type_reference.js\n"
"value": "**Resolved Dependency**\n\n**Code**: http&#8203;://127.0.0.1:4545/subdir/type_reference.js\n"
},
"range": {
"start": {
@ -930,7 +930,7 @@ fn lsp_hover_dependency() {
},
"end":{
"line": 3,
"character": 76
"character": 66
}
}
}))
@ -955,7 +955,7 @@ fn lsp_hover_dependency() {
Some(json!({
"contents": {
"kind": "markdown",
"value": "**Resolved Dependency**\n\n**Code**: http&#8203;://127.0.0.1:4545/cli/tests/subdir/mod1.ts\n"
"value": "**Resolved Dependency**\n\n**Code**: http&#8203;://127.0.0.1:4545/subdir/mod1.ts\n"
},
"range": {
"start": {
@ -964,7 +964,7 @@ fn lsp_hover_dependency() {
},
"end":{
"line": 4,
"character": 66
"character": 56
}
}
}))
@ -2713,7 +2713,7 @@ fn lsp_diagnostics_warn() {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "import * as a from \"http://127.0.0.1:4545/cli/tests/x_deno_warning.js\";\n\nconsole.log(a)\n",
"text": "import * as a from \"http://127.0.0.1:4545/x_deno_warning.js\";\n\nconsole.log(a)\n",
},
}),
);
@ -2726,7 +2726,7 @@ fn lsp_diagnostics_warn() {
},
"uris": [
{
"uri": "http://127.0.0.1:4545/cli/tests/x_deno_warning.js",
"uri": "http://127.0.0.1:4545/x_deno_warning.js",
}
],
}),
@ -2755,7 +2755,7 @@ fn lsp_diagnostics_warn() {
},
end: lsp::Position {
line: 0,
character: 70
character: 60
}
},
severity: Some(lsp::DiagnosticSeverity::Warning),

View file

@ -74,7 +74,7 @@ mod worker;
#[test]
fn help_flag() {
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("--help")
.spawn()
.unwrap()
@ -86,7 +86,7 @@ fn help_flag() {
#[test]
fn version_short_flag() {
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("-V")
.spawn()
.unwrap()
@ -98,7 +98,7 @@ fn version_short_flag() {
#[test]
fn version_long_flag() {
let status = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("--version")
.spawn()
.unwrap()
@ -117,11 +117,10 @@ fn cache_test() {
let _g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
let module_url =
url::Url::parse("http://localhost:4545/cli/tests/006_url_imports.ts")
.unwrap();
url::Url::parse("http://localhost:4545/006_url_imports.ts").unwrap();
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg("-L")
.arg("debug")
@ -141,7 +140,7 @@ fn cache_test() {
.env("DENO_DIR", deno_dir.path())
.env("HTTP_PROXY", "http://nil")
.env("NO_COLOR", "1")
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(module_url.to_string())
.output()
@ -149,8 +148,7 @@ fn cache_test() {
let str_output = std::str::from_utf8(&output.stdout).unwrap();
let module_output_path =
util::root_path().join("cli/tests/006_url_imports.ts.out");
let module_output_path = util::testdata_path().join("006_url_imports.ts.out");
let mut module_output = String::new();
let mut module_output_file = fs::File::open(module_output_path).unwrap();
module_output_file
@ -173,7 +171,7 @@ fn cache_invalidation_test() {
}
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(fixture_path.to_str().unwrap())
.output()
@ -190,7 +188,7 @@ fn cache_invalidation_test() {
}
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(fixture_path.to_str().unwrap())
.output()
@ -213,7 +211,7 @@ fn cache_invalidation_test_no_check() {
}
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--no-check")
.arg(fixture_path.to_str().unwrap())
@ -231,7 +229,7 @@ fn cache_invalidation_test_no_check() {
}
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--no-check")
.arg(fixture_path.to_str().unwrap())
@ -269,7 +267,7 @@ fn ts_dependency_recompilation() {
.unwrap();
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg(&ats)
@ -291,7 +289,7 @@ fn ts_dependency_recompilation() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg(&ats)
@ -312,12 +310,12 @@ fn ts_no_recheck_on_redirect() {
let deno_dir = util::new_deno_dir();
let e = util::deno_exe_path();
let redirect_ts = util::root_path().join("cli/tests/017_import_redirect.ts");
let redirect_ts = util::testdata_path().join("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::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(redirect_ts.clone())
.spawn()
@ -329,7 +327,7 @@ fn ts_no_recheck_on_redirect() {
let mut cmd = Command::new(e);
cmd.env("DENO_DIR", deno_dir.path());
let output = cmd
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(redirect_ts)
.output()
@ -340,12 +338,12 @@ fn ts_no_recheck_on_redirect() {
#[test]
fn ts_reload() {
let hello_ts = util::root_path().join("cli/tests/002_hello.ts");
let hello_ts = util::testdata_path().join("002_hello.ts");
assert!(hello_ts.is_file());
let deno_dir = TempDir::new().expect("tempdir fail");
let mut initial = util::deno_cmd_with_deno_dir(deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg(&hello_ts)
.spawn()
@ -355,7 +353,7 @@ fn ts_reload() {
assert!(status_initial.success());
let output = util::deno_cmd_with_deno_dir(deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg("--reload")
.arg("-L")
@ -391,7 +389,7 @@ console.log("finish");
"#;
let mut p = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("-")
.stdin(std::process::Stdio::piped())
@ -411,7 +409,7 @@ console.log("finish");
#[test]
fn compiler_api() {
let status = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.arg("test")
.arg("--unstable")
.arg("--reload")
@ -431,7 +429,7 @@ fn broken_stdout() {
drop(reader);
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("eval")
.arg("console.log(3.14)")
.stdout(writer)
@ -461,14 +459,14 @@ itest!(cafile_ts_fetch {
});
itest!(cafile_eval {
args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cli/tests/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))",
args: "eval --cert tls/RootCA.pem fetch('https://localhost:5545/cafile_ts_fetch.ts.out').then(r=>r.text()).then(t=>console.log(t.trimEnd()))",
output: "cafile_ts_fetch.ts.out",
http_server: true,
});
itest!(cafile_info {
args:
"info --quiet --cert tls/RootCA.pem https://localhost:5545/cli/tests/cafile_info.ts",
"info --quiet --cert tls/RootCA.pem https://localhost:5545/cafile_info.ts",
output: "cafile_info.ts.out",
http_server: true,
});
@ -506,13 +504,12 @@ fn cafile_env_fetch() {
let _g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
let module_url =
Url::parse("https://localhost:5545/cli/tests/cafile_url_imports.ts")
.unwrap();
let cafile = util::root_path().join("cli/tests/tls/RootCA.pem");
Url::parse("https://localhost:5545/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::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg(module_url.to_string())
.output()
@ -526,12 +523,11 @@ fn cafile_fetch() {
let _g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
let module_url =
Url::parse("http://localhost:4545/cli/tests/cafile_url_imports.ts")
.unwrap();
let cafile = util::root_path().join("cli/tests/tls/RootCA.pem");
Url::parse("http://localhost:4545/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::root_path())
.current_dir(util::testdata_path())
.arg("cache")
.arg("--cert")
.arg(cafile)
@ -550,11 +546,11 @@ fn cafile_install_remote_module() {
let bin_dir = temp_dir.path().join("bin");
std::fs::create_dir(&bin_dir).unwrap();
let deno_dir = TempDir::new().expect("tempdir fail");
let cafile = util::root_path().join("cli/tests/tls/RootCA.pem");
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::root_path())
.current_dir(util::testdata_path())
.arg("install")
.arg("--cert")
.arg(cafile)
@ -562,7 +558,7 @@ fn cafile_install_remote_module() {
.arg(temp_dir.path())
.arg("-n")
.arg("echo_test")
.arg("https://localhost:5545/cli/tests/echo.ts")
.arg("https://localhost:5545/echo.ts")
.output()
.expect("Failed to spawn script");
println!("{}", std::str::from_utf8(&install_output.stdout).unwrap());
@ -590,12 +586,12 @@ 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/cli/tests/subdir/mod1.ts";
let cafile = util::root_path().join("cli/tests/tls/RootCA.pem");
let mod1 = "https://localhost:5545/subdir/mod1.ts";
let cafile = util::testdata_path().join("tls/RootCA.pem");
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("mod1.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg("--cert")
.arg(cafile)
@ -618,7 +614,7 @@ fn cafile_bundle_remote_exports() {
.expect("error writing file");
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(&test)
.output()
@ -635,8 +631,8 @@ fn cafile_bundle_remote_exports() {
fn websocket() {
let _g = util::http_server();
let script = util::tests_path().join("websocket_test.ts");
let root_ca = util::tests_path().join("tls/RootCA.pem");
let script = util::testdata_path().join("websocket_test.ts");
let root_ca = util::testdata_path().join("tls/RootCA.pem");
let status = util::deno_cmd()
.arg("test")
.arg("--unstable")
@ -656,8 +652,8 @@ fn websocket() {
fn websocketstream() {
let _g = util::http_server();
let script = util::tests_path().join("websocketstream_test.ts");
let root_ca = util::tests_path().join("tls/RootCA.pem");
let script = util::testdata_path().join("websocketstream_test.ts");
let root_ca = util::testdata_path().join("tls/RootCA.pem");
let status = util::deno_cmd()
.arg("test")
.arg("--unstable")
@ -872,7 +868,7 @@ async fn test_resolve_dns() {
// Pass: `--allow-net`
{
let output = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg("--allow-net")
@ -890,7 +886,7 @@ async fn test_resolve_dns() {
assert!(err.starts_with("Check file"));
let expected =
std::fs::read_to_string(util::tests_path().join("resolve_dns.ts.out"))
std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out"))
.unwrap();
assert_eq!(expected, out);
}
@ -898,7 +894,7 @@ async fn test_resolve_dns() {
// Pass: `--allow-net=127.0.0.1:4553`
{
let output = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg("--allow-net=127.0.0.1:4553")
@ -916,7 +912,7 @@ async fn test_resolve_dns() {
assert!(err.starts_with("Check file"));
let expected =
std::fs::read_to_string(util::tests_path().join("resolve_dns.ts.out"))
std::fs::read_to_string(util::testdata_path().join("resolve_dns.ts.out"))
.unwrap();
assert_eq!(expected, out);
}
@ -924,7 +920,7 @@ async fn test_resolve_dns() {
// Permission error: `--allow-net=deno.land`
{
let output = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg("--allow-net=deno.land")
@ -947,7 +943,7 @@ async fn test_resolve_dns() {
// Permission error: no permission specified
{
let output = util::deno_cmd()
.current_dir(util::tests_path())
.current_dir(util::testdata_path())
.env("NO_COLOR", "1")
.arg("run")
.arg("--unstable")
@ -1001,7 +997,7 @@ fn js_unit_tests_lint() {
let status = util::deno_cmd()
.arg("lint")
.arg("--unstable")
.arg(util::root_path().join("cli/tests/unit"))
.arg(util::tests_path().join("unit"))
.spawn()
.unwrap()
.wait()
@ -1022,7 +1018,7 @@ fn js_unit_tests() {
.arg("--unstable")
.arg("--location=http://js-unit-tests/foo/bar")
.arg("-A")
.arg("cli/tests/unit")
.arg(util::tests_path().join("unit"))
.spawn()
.expect("failed to spawn script");
@ -1038,13 +1034,13 @@ async fn listen_tls_alpn() {
LocalSet::new()
.run_until(async {
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--unstable")
.arg("--quiet")
.arg("--allow-net")
.arg("--allow-read")
.arg("./cli/tests/listen_tls_alpn.ts")
.arg("./listen_tls_alpn.ts")
.arg("4504")
.stdout(std::process::Stdio::piped())
.spawn()
@ -1057,8 +1053,9 @@ async fn listen_tls_alpn() {
assert_eq!(msg, "READY");
let mut cfg = rustls::ClientConfig::new();
let reader =
&mut BufReader::new(Cursor::new(include_bytes!("../tls/RootCA.crt")));
let reader = &mut BufReader::new(Cursor::new(include_bytes!(
"../testdata/tls/RootCA.crt"
)));
cfg.root_store.add_pem_file(reader).unwrap();
cfg.alpn_protocols.push("foobar".as_bytes().to_vec());
let cfg = Arc::new(cfg);
@ -1090,13 +1087,13 @@ async fn listen_tls_alpn_fail() {
LocalSet::new()
.run_until(async {
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--unstable")
.arg("--quiet")
.arg("--allow-net")
.arg("--allow-read")
.arg("./cli/tests/listen_tls_alpn.ts")
.arg("./listen_tls_alpn.ts")
.arg("4505")
.stdout(std::process::Stdio::piped())
.spawn()
@ -1109,8 +1106,9 @@ async fn listen_tls_alpn_fail() {
assert_eq!(msg, "READY");
let mut cfg = rustls::ClientConfig::new();
let reader =
&mut BufReader::new(Cursor::new(include_bytes!("../tls/RootCA.crt")));
let reader = &mut BufReader::new(Cursor::new(include_bytes!(
"../testdata/tls/RootCA.crt"
)));
cfg.root_store.add_pem_file(reader).unwrap();
cfg.alpn_protocols.push("boofar".as_bytes().to_vec());
let cfg = Arc::new(cfg);

View file

@ -549,8 +549,7 @@ fn lexical_scoped_variable() {
fn missing_deno_dir() {
use std::fs::{read_dir, remove_dir_all};
const DENO_DIR: &str = "nonexistent";
let test_deno_dir =
util::root_path().join("cli").join("tests").join(DENO_DIR);
let test_deno_dir = test_util::testdata_path().join(DENO_DIR);
let (out, err) = util::run_and_collect_output(
true,
"repl",

View file

@ -144,7 +144,7 @@ itest!(_033_import_map {
itest!(_033_import_map_remote {
args:
"run --quiet --reload --import-map=http://127.0.0.1:4545/cli/tests/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts",
"run --quiet --reload --import-map=http://127.0.0.1:4545/import_maps/import_map_remote.json --unstable import_maps/test_remote.ts",
output: "033_import_map_remote.out",
http_server: true,
});
@ -155,8 +155,7 @@ itest!(_034_onload {
});
itest!(_035_cached_only_flag {
args:
"run --reload --cached-only http://127.0.0.1:4545/cli/tests/019_media_types.ts",
args: "run --reload --cached-only http://127.0.0.1:4545/019_media_types.ts",
output: "035_cached_only_flag.out",
exit_code: 1,
http_server: true,
@ -203,8 +202,7 @@ itest!(_048_media_types_jsx {
});
itest!(_052_no_remote_flag {
args:
"run --reload --no-remote http://127.0.0.1:4545/cli/tests/019_media_types.ts",
args: "run --reload --no-remote http://127.0.0.1:4545/019_media_types.ts",
output: "052_no_remote_flag.out",
exit_code: 1,
http_server: true,
@ -239,7 +237,7 @@ itest!(_071_location_unset {
});
itest!(_072_location_relative_fetch {
args: "run --location http://127.0.0.1:4545/cli/tests/ --allow-net 072_location_relative_fetch.ts",
args: "run --location http://127.0.0.1:4545/ --allow-net 072_location_relative_fetch.ts",
output: "072_location_relative_fetch.ts.out",
http_server: true,
});
@ -288,18 +286,17 @@ itest!(_082_prepare_stack_trace_throw {
fn _083_legacy_external_source_map() {
let _g = util::http_server();
let deno_dir = TempDir::new().expect("tempdir fail");
let module_url = url::Url::parse(
"http://localhost:4545/cli/tests/083_legacy_external_source_map.ts",
)
let module_url =
url::Url::parse("http://localhost:4545/083_legacy_external_source_map.ts")
.unwrap();
// Write a faulty old external source map.
let faulty_map_path = deno_dir.path().join("gen/http/localhost_PORT4545/9576bd5febd0587c5c4d88d57cb3ac8ebf2600c529142abe3baa9a751d20c334.js.map");
std::fs::create_dir_all(faulty_map_path.parent().unwrap())
.expect("Failed to create faulty source map dir.");
std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/cli/tests/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map.");
std::fs::write(faulty_map_path, "{\"version\":3,\"file\":\"\",\"sourceRoot\":\"\",\"sources\":[\"http://localhost:4545/083_legacy_external_source_map.ts\"],\"names\":[],\"mappings\":\";AAAA,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC\"}").expect("Failed to write faulty source map.");
let output = Command::new(util::deno_exe_path())
.env("DENO_DIR", deno_dir.path())
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg(module_url.to_string())
.output()
@ -394,7 +391,8 @@ itest!(lock_write_fetch {
});
itest!(lock_check_ok {
args: "run --lock=lock_check_ok.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts",
args:
"run --lock=lock_check_ok.json http://127.0.0.1:4545/003_relative_import.ts",
output: "003_relative_import.ts.out",
http_server: true,
});
@ -406,14 +404,14 @@ itest!(lock_check_ok2 {
});
itest!(lock_dynamic_imports {
args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/cli/tests/013_dynamic_import.ts",
args: "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/013_dynamic_import.ts",
output: "lock_dynamic_imports.out",
exit_code: 10,
http_server: true,
});
itest!(lock_check_err {
args: "run --lock=lock_check_err.json http://127.0.0.1:4545/cli/tests/003_relative_import.ts",
args: "run --lock=lock_check_err.json http://127.0.0.1:4545/003_relative_import.ts",
output: "lock_check_err.out",
exit_code: 10,
http_server: true,
@ -452,7 +450,7 @@ itest!(config_types_remote {
itest!(empty_typescript {
args: "run --reload subdir/empty.ts",
output_str: Some("Check file:[WILDCARD]tests/subdir/empty.ts\n"),
output_str: Some("Check file:[WILDCARD]/subdir/empty.ts\n"),
});
itest!(error_001 {
@ -649,14 +647,14 @@ itest!(error_type_definitions {
});
itest!(error_local_static_import_from_remote_ts {
args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.ts",
args: "run --reload http://localhost:4545/error_local_static_import_from_remote.ts",
exit_code: 1,
http_server: true,
output: "error_local_static_import_from_remote.ts.out",
});
itest!(error_local_static_import_from_remote_js {
args: "run --reload http://localhost:4545/cli/tests/error_local_static_import_from_remote.js",
args: "run --reload http://localhost:4545/error_local_static_import_from_remote.js",
exit_code: 1,
http_server: true,
output: "error_local_static_import_from_remote.js.out",
@ -938,14 +936,14 @@ itest!(_053_import_compression {
});
itest!(disallow_http_from_https_js {
args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.js",
args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.js",
output: "disallow_http_from_https_js.out",
http_server: true,
exit_code: 1,
});
itest!(disallow_http_from_https_ts {
args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/cli/tests/disallow_http_from_https.ts",
args: "run --quiet --reload --cert tls/RootCA.pem https://localhost:5545/disallow_http_from_https.ts",
output: "disallow_http_from_https_ts.out",
http_server: true,
exit_code: 1,
@ -1175,9 +1173,9 @@ itest!(worker_close_race {
#[test]
fn no_validate_asm() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/no_validate_asm.js")
.arg("no_validate_asm.js")
.stderr(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped())
.spawn()
@ -1192,10 +1190,10 @@ fn no_validate_asm() {
#[test]
fn exec_path() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--allow-read")
.arg("cli/tests/exec_path.ts")
.arg("exec_path.ts")
.stdout(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -1223,7 +1221,7 @@ fn run_deno_script_constrained(
script_path: std::path::PathBuf,
constraints: WinProcConstraints,
) -> Result<(), i64> {
let file_path = "cli/tests/DenoWinRunner.ps1";
let file_path = "DenoWinRunner.ps1";
let constraints = match constraints {
WinProcConstraints::NoStdIn => "1",
WinProcConstraints::NoStdOut => "2",
@ -1244,7 +1242,7 @@ fn run_deno_script_constrained(
#[test]
fn should_not_panic_on_no_stdin() {
let output = run_deno_script_constrained(
util::tests_path().join("echo.ts"),
util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdIn,
);
output.unwrap();
@ -1254,7 +1252,7 @@ fn should_not_panic_on_no_stdin() {
#[test]
fn should_not_panic_on_no_stdout() {
let output = run_deno_script_constrained(
util::tests_path().join("echo.ts"),
util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdOut,
);
output.unwrap();
@ -1264,7 +1262,7 @@ fn should_not_panic_on_no_stdout() {
#[test]
fn should_not_panic_on_no_stderr() {
let output = run_deno_script_constrained(
util::tests_path().join("echo.ts"),
util::testdata_path().join("echo.ts"),
WinProcConstraints::NoStdErr,
);
output.unwrap();
@ -1274,9 +1272,9 @@ fn should_not_panic_on_no_stderr() {
#[test]
fn should_not_panic_on_undefined_home_environment_variable() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/echo.ts")
.arg("echo.ts")
.env_remove("HOME")
.spawn()
.unwrap()
@ -1288,9 +1286,9 @@ fn should_not_panic_on_undefined_home_environment_variable() {
#[test]
fn should_not_panic_on_undefined_deno_dir_environment_variable() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/echo.ts")
.arg("echo.ts")
.env_remove("DENO_DIR")
.spawn()
.unwrap()
@ -1303,9 +1301,9 @@ fn should_not_panic_on_undefined_deno_dir_environment_variable() {
#[test]
fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() {
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/echo.ts")
.arg("echo.ts")
.env_remove("DENO_DIR")
.env_remove("HOME")
.spawn()
@ -1319,9 +1317,9 @@ fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() {
fn rust_log() {
// Without RUST_LOG the stderr is empty.
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/001_hello.js")
.arg("001_hello.js")
.stderr(std::process::Stdio::piped())
.spawn()
.unwrap()
@ -1332,9 +1330,9 @@ fn rust_log() {
// With RUST_LOG the stderr is not empty.
let output = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("cli/tests/001_hello.js")
.arg("001_hello.js")
.env("RUST_LOG", "debug")
.stderr(std::process::Stdio::piped())
.spawn()
@ -1352,7 +1350,7 @@ mod permissions {
fn with_allow() {
for permission in &util::PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}", permission))
.arg("permission_test.ts")
@ -1384,12 +1382,15 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
util::root_path().into_os_string().into_string().unwrap()
util::testdata_path()
.into_os_string()
.into_string()
.unwrap()
))
.arg("complex_permissions_test.ts")
.arg(permission)
@ -1411,9 +1412,7 @@ mod permissions {
&format!(
"run --allow-{0}={1} complex_permissions_test.ts {0} {2}",
permission,
util::root_path()
.join("cli")
.join("tests")
util::testdata_path()
.into_os_string()
.into_string()
.unwrap(),
@ -1436,14 +1435,12 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!(
"--allow-{0}={1}",
permission,
util::root_path()
.join("cli")
.join("tests")
util::testdata_path()
.into_os_string()
.into_string()
.unwrap()
@ -1462,9 +1459,7 @@ mod permissions {
#[test]
fn rw_outside_test_and_js_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
let test_dir = util::root_path()
.join("cli")
.join("tests")
let test_dir = util::testdata_path()
.into_os_string()
.into_string()
.unwrap();
@ -1498,9 +1493,7 @@ mod permissions {
#[test]
fn rw_inside_test_and_js_dir() {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
let test_dir = util::root_path()
.join("cli")
.join("tests")
let test_dir = util::testdata_path()
.into_os_string()
.into_string()
.unwrap();
@ -1511,7 +1504,7 @@ mod permissions {
.unwrap();
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir))
.arg("complex_permissions_test.ts")
@ -1530,7 +1523,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}=.", permission))
.arg("complex_permissions_test.ts")
@ -1549,7 +1542,7 @@ mod permissions {
const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"];
for permission in &PERMISSION_VARIANTS {
let status = util::deno_cmd()
.current_dir(&util::tests_path())
.current_dir(&util::testdata_path())
.arg("run")
.arg(format!("--allow-{0}=tls/../", permission))
.arg("complex_permissions_test.ts")

View file

@ -50,15 +50,15 @@ fn wait_for_process_failed(
#[test]
fn fmt_watch_test() {
let t = TempDir::new().expect("tempdir fail");
let fixed = util::root_path().join("cli/tests/badly_formatted_fixed.js");
let fixed = util::testdata_path().join("badly_formatted_fixed.js");
let badly_formatted_original =
util::root_path().join("cli/tests/badly_formatted.mjs");
util::testdata_path().join("badly_formatted.mjs");
let badly_formatted = t.path().join("badly_formatted.js");
std::fs::copy(&badly_formatted_original, &badly_formatted)
.expect("Failed to copy file");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("fmt")
.arg(&badly_formatted)
.arg("--watch")
@ -109,7 +109,7 @@ fn bundle_js_watch() {
let t = TempDir::new().expect("tempdir fail");
let bundle = t.path().join("mod6.bundle.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(&file_to_watch)
.arg(&bundle)
@ -173,7 +173,7 @@ fn bundle_watch_not_exit() {
let target_file = t.path().join("target.js");
let mut deno = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("bundle")
.arg(&file_to_watch)
.arg(&target_file)
@ -224,7 +224,7 @@ fn run_watch() {
.expect("error writing file");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--watch")
.arg("--unstable")
@ -330,7 +330,7 @@ fn run_watch_not_exit() {
.expect("error writing file");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--watch")
.arg("--unstable")
@ -377,14 +377,14 @@ fn run_watch_with_import_map_and_relative_paths() {
let absolute_path = directory.path().join(filename);
std::fs::write(&absolute_path, filecontent).expect("error writing file");
let relative_path = absolute_path
.strip_prefix(util::root_path())
.strip_prefix(util::testdata_path())
.expect("unable to create relative temporary file")
.to_owned();
assert!(relative_path.is_relative());
relative_path
}
let temp_directory =
TempDir::new_in(util::root_path()).expect("tempdir fail");
TempDir::new_in(util::testdata_path()).expect("tempdir fail");
let file_to_watch = create_relative_tmp_file(
&temp_directory,
"file_to_watch.js",
@ -397,7 +397,7 @@ fn run_watch_with_import_map_and_relative_paths() {
);
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("run")
.arg("--unstable")
.arg("--watch")
@ -443,7 +443,7 @@ fn test_watch() {
let t = TempDir::new().expect("tempdir fail");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("test")
.arg("--watch")
.arg("--unstable")
@ -612,7 +612,7 @@ fn test_watch_doc() {
let t = TempDir::new().expect("tempdir fail");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.current_dir(util::testdata_path())
.arg("test")
.arg("--watch")
.arg("--doc")

View file

@ -3,7 +3,7 @@
use crate::itest;
itest!(workers {
args: "test --reload --location http://127.0.0.1:4545/cli/tests/ --allow-net --allow-read --unstable workers/test.ts",
args: "test --reload --location http://127.0.0.1:4545/ --allow-net --allow-read --unstable workers/test.ts",
output: "workers/test.ts.out",
http_server: true,
});

View file

@ -1,3 +0,0 @@
DANGER: TLS certificate validation is disabled for: deno.land
error: error sending request for url (https://localhost:5545/cli/tests/subdir/mod2.ts): error trying to connect: invalid certificate: UnknownIssuer
at [WILDCARD]tests/cafile_url_imports.ts:1:0

View file

@ -1,4 +0,0 @@
{
"http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"http://127.0.0.1:4545/cli/tests/003_relative_import.ts": "bad"
}

View file

@ -1,10 +0,0 @@
{
"http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js": "bad",
"http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18"
}

View file

@ -1,5 +0,0 @@
{
"http://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f",
"http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts": "bad"
}

View file

@ -1,4 +0,0 @@
{
"http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"http://127.0.0.1:4545/cli/tests/003_relative_import.ts": "aa9e16de824f81871a1c7164d5bd6857df7db2e18621750bd66b0bde4df07f21"
}

View file

@ -1,10 +0,0 @@
{
"http://localhost:4545/cli/tests/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18",
"http://localhost:4545/cli/tests/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18"
}

View file

@ -1,6 +0,0 @@
{
"http://127.0.0.1:4545/cli/tests/013_dynamic_import.ts": "f0d2d108c100e769cda9f26b74326f21e44cab81611aa7f6cd2b731d4cbc1995",
"http://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f",
"http://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts": "bad"
}

View file

@ -1,8 +0,0 @@
{
"textDocument": {
"uri": "file:///a/file.ts",
"languageId": "typescript",
"version": 1,
"text": "import * as a from \"http://127.0.0.1:4545/xTypeScriptTypes.js\";\n// @deno-types=\"http://127.0.0.1:4545/cli/tests/type_definitions/foo.d.ts\"\nimport * as b from \"http://127.0.0.1:4545/cli/tests/type_definitions/foo.js\";\nimport * as c from \"http://127.0.0.1:4545/cli/tests/subdir/type_reference.js\";\nimport * as d from \"http://127.0.0.1:4545/cli/tests/subdir/mod1.ts\";\nimport * as e from \"data:application/typescript;base64,ZXhwb3J0IGNvbnN0IGEgPSAiYSI7CgpleHBvcnQgZW51bSBBIHsKICBBLAogIEIsCiAgQywKfQo=\";\nimport * as f from \"./file_01.ts\";\n\nconsole.log(a, b, c, d, e, f);\n"
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
main_module2 [WILDCARD]tests/main_module.ts
main_module [WILDCARD]tests/main_module.ts

View file

@ -1,5 +0,0 @@
Download http://localhost:4548/cli/tests/subdir/redirects/a.ts
Download http://localhost:4546/cli/tests/subdir/redirects/a.ts
Download http://localhost:4545/cli/tests/subdir/redirects/a.ts
Download http://localhost:4545/cli/tests/subdir/redirects/b.ts
Check http://localhost:4548/cli/tests/subdir/redirects/a.ts

View file

@ -1,3 +0,0 @@
/// <reference types="http://localhost:4545/cli/tests/subdir/types.d.ts" />
console.log(globalThis.a);

3
cli/tests/testdata/006_url_imports.ts vendored Normal file
View file

@ -0,0 +1,3 @@
import { printHello } from "http://localhost:4545/subdir/mod2.ts";
printHello();
console.log("success");

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