diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index 5aa299518545b93873254e4f71f00b7cf09fbbcb..b86a1a7ae033852eee8bad0ccee0e27d54c19741 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -700,7 +700,7 @@ mod tests { let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() - .join("tests/002_hello.ts"); + .join("cli/tests/002_hello.ts"); let specifier = ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()).unwrap(); @@ -739,7 +739,7 @@ mod tests { let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() - .join("tests/002_hello.ts"); + .join("cli/tests/002_hello.ts"); use deno_core::ModuleSpecifier; let module_name = ModuleSpecifier::resolve_url_or_path(p.to_str().unwrap()) .unwrap() diff --git a/cli/file_fetcher.rs b/cli/file_fetcher.rs index c8916650935b7a8505152f79db4ce29a2a4115c3..d4698e23309a0944f2b8ab9e9c27076aeb0238e3 100644 --- a/cli/file_fetcher.rs +++ b/cli/file_fetcher.rs @@ -1005,7 +1005,7 @@ mod tests { let fetcher_1 = fetcher.clone(); let fetcher_2 = fetcher.clone(); let module_url = - Url::parse("http://localhost:4545/tests/subdir/mod2.ts").unwrap(); + Url::parse("http://localhost:4545/cli/tests/subdir/mod2.ts").unwrap(); let module_url_1 = module_url.clone(); let module_url_2 = module_url.clone(); let headers_file_name = fetcher.deps_cache.location.join( @@ -1106,7 +1106,8 @@ mod tests { let (temp_dir, fetcher) = test_setup(); let fetcher_1 = fetcher.clone(); let module_url = - Url::parse("http://localhost:4545/tests/subdir/mismatch_ext.ts").unwrap(); + Url::parse("http://localhost:4545/cli/tests/subdir/mismatch_ext.ts") + .unwrap(); let module_url_1 = module_url.clone(); let module_url_2 = module_url.clone(); let headers_file_name = fetcher.deps_cache.location.join( @@ -1183,7 +1184,7 @@ mod tests { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); let specifier = ModuleSpecifier::resolve_url( - "http://localhost:4545/tests/subdir/mismatch_ext.ts", + "http://localhost:4545/cli/tests/subdir/mismatch_ext.ts", ) .unwrap(); let headers_file_name = fetcher.deps_cache.location.join( @@ -1231,22 +1232,24 @@ mod tests { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); - let redirect_module_url = - Url::parse("http://localhost:4546/tests/subdir/redirects/redirect1.js") - .unwrap(); + let redirect_module_url = Url::parse( + "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let redirect_source_filepath = fetcher .deps_cache .location - .join("http/localhost_PORT4546/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4546/cli/tests/subdir/redirects/redirect1.js"); let redirect_source_filename = redirect_source_filepath.to_str().unwrap().to_string(); - let target_module_url = - Url::parse("http://localhost:4545/tests/subdir/redirects/redirect1.js") - .unwrap(); + let target_module_url = Url::parse( + "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let redirect_target_filepath = fetcher .deps_cache .location - .join("http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4545/cli/tests/subdir/redirects/redirect1.js"); let redirect_target_filename = redirect_target_filepath.to_str().unwrap().to_string(); @@ -1263,7 +1266,7 @@ mod tests { fetcher.get_source_code_headers(&redirect_module_url); assert_eq!( redirect_source_headers.redirect_to.unwrap(), - "http://localhost:4545/tests/subdir/redirects/redirect1.js" + "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js" ); // The target of redirection is downloaded instead. assert_eq!( @@ -1286,29 +1289,32 @@ mod tests { fn test_get_source_code_4() { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); - let double_redirect_url = - Url::parse("http://localhost:4548/tests/subdir/redirects/redirect1.js") - .unwrap(); + let double_redirect_url = Url::parse( + "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let double_redirect_path = fetcher .deps_cache .location - .join("http/localhost_PORT4548/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4548/cli/tests/subdir/redirects/redirect1.js"); - let redirect_url = - Url::parse("http://localhost:4546/tests/subdir/redirects/redirect1.js") - .unwrap(); + let redirect_url = Url::parse( + "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let redirect_path = fetcher .deps_cache .location - .join("http/localhost_PORT4546/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4546/cli/tests/subdir/redirects/redirect1.js"); - let target_url = - Url::parse("http://localhost:4545/tests/subdir/redirects/redirect1.js") - .unwrap(); + let target_url = Url::parse( + "http://localhost:4545/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let target_path = fetcher .deps_cache .location - .join("http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4545/cli/tests/subdir/redirects/redirect1.js"); // Test double redirects and headers recording let fut = fetcher @@ -1353,18 +1359,20 @@ mod tests { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); - let double_redirect_url = - Url::parse("http://localhost:4548/tests/subdir/redirects/redirect1.js") - .unwrap(); + let double_redirect_url = Url::parse( + "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); - let redirect_url = - Url::parse("http://localhost:4546/tests/subdir/redirects/redirect1.js") - .unwrap(); + let redirect_url = Url::parse( + "http://localhost:4546/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); let target_path = fetcher .deps_cache .location - .join("http/localhost_PORT4545/tests/subdir/redirects/redirect1.js"); + .join("http/localhost_PORT4545/cli/tests/subdir/redirects/redirect1.js"); let target_path_ = target_path.clone(); // Test that redirect target is not downloaded twice for different redirect source. @@ -1406,9 +1414,10 @@ mod tests { fn test_get_source_code_6() { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); - let double_redirect_url = - Url::parse("http://localhost:4548/tests/subdir/redirects/redirect1.js") - .unwrap(); + let double_redirect_url = Url::parse( + "http://localhost:4548/cli/tests/subdir/redirects/redirect1.js", + ) + .unwrap(); // Test that redirections can be limited let fut = fetcher @@ -1432,7 +1441,7 @@ mod tests { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); let module_url = - Url::parse("http://localhost:4545/tests/002_hello.ts").unwrap(); + Url::parse("http://localhost:4545/cli/tests/002_hello.ts").unwrap(); // Remote modules are not allowed let fut = fetcher .get_source_file_async(&module_url, true, true, false) @@ -1453,7 +1462,7 @@ mod tests { let fetcher_1 = fetcher.clone(); let fetcher_2 = fetcher.clone(); let module_url = - Url::parse("http://localhost:4545/tests/002_hello.ts").unwrap(); + Url::parse("http://localhost:4545/cli/tests/002_hello.ts").unwrap(); let module_url_1 = module_url.clone(); let module_url_2 = module_url.clone(); // file hasn't been cached before @@ -1485,7 +1494,7 @@ mod tests { let http_server_guard = crate::test_util::http_server(); let (_temp_dir, fetcher) = test_setup(); let module_url = - Url::parse("http://127.0.0.1:4545/tests/subdir/mt_video_mp2t.t3.ts") + Url::parse("http://127.0.0.1:4545/cli/tests/subdir/mt_video_mp2t.t3.ts") .unwrap(); let headers_file_name = fetcher.deps_cache.location.join( fetcher @@ -1528,7 +1537,7 @@ mod tests { let (_temp_dir, fetcher) = test_setup(); let module_url = - Url::parse("http://localhost:4545/tests/subdir/mt_video_mp2t.t3.ts") + Url::parse("http://localhost:4545/cli/tests/subdir/mt_video_mp2t.t3.ts") .unwrap(); let headers_file_name = fetcher.deps_cache.location.join( fetcher @@ -1574,12 +1583,13 @@ mod tests { let fetcher_2 = fetcher.clone(); let fetcher_3 = fetcher.clone(); let module_url = - Url::parse("http://localhost:4545/tests/subdir/no_ext").unwrap(); + Url::parse("http://localhost:4545/cli/tests/subdir/no_ext").unwrap(); let module_url_2 = - Url::parse("http://localhost:4545/tests/subdir/mismatch_ext.ts").unwrap(); + Url::parse("http://localhost:4545/cli/tests/subdir/mismatch_ext.ts") + .unwrap(); let module_url_2_ = module_url_2.clone(); let module_url_3 = - Url::parse("http://localhost:4545/tests/subdir/unknown_ext.deno") + Url::parse("http://localhost:4545/cli/tests/subdir/unknown_ext.deno") .unwrap(); let module_url_3_ = module_url_3.clone(); diff --git a/cli/installer.rs b/cli/installer.rs index 2d47f6a04a552e949c47870e0a597a96abcb0d77..d5e90a2526c3a3ce63c46388c202dc0c0a73dd5f 100644 --- a/cli/installer.rs +++ b/cli/installer.rs @@ -257,7 +257,7 @@ mod tests { DenoFlags::default(), None, "echo_test", - "http://localhost:4545/tests/echo_server.ts", + "http://localhost:4545/cli/tests/echo_server.ts", vec![], ) .expect("Install failed"); @@ -274,11 +274,11 @@ mod tests { let expected_content = if cfg!(windows) { r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. % @IF EXIST "%~dp0\deno.exe" ( - "%~dp0\deno.exe" "run" "http://localhost:4545/tests/echo_server.ts" %* + "%~dp0\deno.exe" "run" "http://localhost:4545/cli/tests/echo_server.ts" %* ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.TS;=;% - "deno" "run" "http://localhost:4545/tests/echo_server.ts" %* + "deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" %* ) "# } else { @@ -291,10 +291,10 @@ case \`uname\` in esac if [ -x "$basedir/deno" ]; then - "$basedir/deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@" + "$basedir/deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" "$@" ret=$? else - "deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@" + "deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" "$@" ret=$? fi exit $ret @@ -319,7 +319,7 @@ exit $ret DenoFlags::default(), Some(temp_dir.path().to_string_lossy().to_string()), "echo_test", - "http://localhost:4545/tests/echo_server.ts", + "http://localhost:4545/cli/tests/echo_server.ts", vec![], ) .expect("Install failed"); @@ -335,11 +335,11 @@ exit $ret let expected_content = if cfg!(windows) { r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. % @IF EXIST "%~dp0\deno.exe" ( - "%~dp0\deno.exe" "run" "http://localhost:4545/tests/echo_server.ts" %* + "%~dp0\deno.exe" "run" "http://localhost:4545/cli/tests/echo_server.ts" %* ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.TS;=;% - "deno" "run" "http://localhost:4545/tests/echo_server.ts" %* + "deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" %* ) "# } else { @@ -352,10 +352,10 @@ case \`uname\` in esac if [ -x "$basedir/deno" ]; then - "$basedir/deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@" + "$basedir/deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" "$@" ret=$? else - "deno" "run" "http://localhost:4545/tests/echo_server.ts" "$@" + "deno" "run" "http://localhost:4545/cli/tests/echo_server.ts" "$@" ret=$? fi exit $ret @@ -377,7 +377,7 @@ exit $ret }, Some(temp_dir.path().to_string_lossy().to_string()), "echo_test", - "http://localhost:4545/tests/echo_server.ts", + "http://localhost:4545/cli/tests/echo_server.ts", vec!["--foobar".to_string()], ) .expect("Install failed"); @@ -393,11 +393,11 @@ exit $ret let expected_content = if cfg!(windows) { r#"% This executable is generated by Deno. Please don't modify it unless you know what it means. % @IF EXIST "%~dp0\deno.exe" ( - "%~dp0\deno.exe" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" %* + "%~dp0\deno.exe" "run" "--allow-read" "--allow-net" "http://localhost:4545/cli/tests/echo_server.ts" "--foobar" %* ) ELSE ( @SETLOCAL @SET PATHEXT=%PATHEXT:;.TS;=;% - "deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" %* + "deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/cli/tests/echo_server.ts" "--foobar" %* ) "# } else { @@ -410,10 +410,10 @@ case \`uname\` in esac if [ -x "$basedir/deno" ]; then - "$basedir/deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" "$@" + "$basedir/deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/cli/tests/echo_server.ts" "--foobar" "$@" ret=$? else - "deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/tests/echo_server.ts" "--foobar" "$@" + "deno" "run" "--allow-read" "--allow-net" "http://localhost:4545/cli/tests/echo_server.ts" "--foobar" "$@" ret=$? fi exit $ret diff --git a/cli/js/body_test.ts b/cli/js/body_test.ts index bb4d0a45185f219d2b64cfd3efd6fa5fa1551da3..2ac4d1314f4b5bb496d0a9e9e355121b555eea9c 100644 --- a/cli/js/body_test.ts +++ b/cli/js/body_test.ts @@ -34,7 +34,7 @@ test(async function arrayBufferFromByteArrays(): Promise { //FormData testPerm({ net: true }, async function bodyMultipartFormData(): Promise { const response = await fetch( - "http://localhost:4545/tests/subdir/multipart_form_data.txt" + "http://localhost:4545/cli/tests/subdir/multipart_form_data.txt" ); const text = await response.text(); @@ -51,7 +51,7 @@ testPerm({ net: true }, async function bodyMultipartFormData(): Promise { testPerm({ net: true }, async function bodyURLEncodedFormData(): Promise { const response = await fetch( - "http://localhost:4545/tests/subdir/form_urlencoded.txt" + "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt" ); const text = await response.text(); diff --git a/cli/js/compiler_util.ts b/cli/js/compiler_util.ts index f541ea46fc3ae82fcea0668460dcdf00cf979130..b58d8da43dbaa0f0b45d5ef57e23e58a34f59eb7 100644 --- a/cli/js/compiler_util.ts +++ b/cli/js/compiler_util.ts @@ -293,7 +293,7 @@ export const ignoredDiagnostics = [ // TS5009: Cannot find the common subdirectory path for the input files. 5009, // TS5055: Cannot write file - // 'http://localhost:4545/tests/subdir/mt_application_x_javascript.j4.js' + // 'http://localhost:4545/cli/tests/subdir/mt_application_x_javascript.j4.js' // because it would overwrite input file. 5055, // TypeScript is overly opinionated that only CommonJS modules kinds can diff --git a/cli/js/fetch_test.ts b/cli/js/fetch_test.ts index 92d1176ccc7b3cefe8fb0095a7d67ed4389453d6..b8a7c8641a4e55a9233c1f484494c97632f4017e 100644 --- a/cli/js/fetch_test.ts +++ b/cli/js/fetch_test.ts @@ -114,7 +114,7 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess(): Promise< void > { const response = await fetch( - "http://localhost:4545/tests/subdir/multipart_form_data.txt" + "http://localhost:4545/cli/tests/subdir/multipart_form_data.txt" ); const formData = await response.formData(); assert(formData.has("field_1")); @@ -131,7 +131,7 @@ testPerm( { net: true }, async function fetchURLEncodedFormDataSuccess(): Promise { const response = await fetch( - "http://localhost:4545/tests/subdir/form_urlencoded.txt" + "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt" ); const formData = await response.formData(); assert(formData.has("field_1")); @@ -153,11 +153,11 @@ testPerm({ net: true }, async function fetchWithRedirection(): Promise { testPerm({ net: true }, async function fetchWithRelativeRedirection(): Promise< void > { - const response = await fetch("http://localhost:4545/tests"); // will redirect to /tests/ + const response = await fetch("http://localhost:4545/cli/tests"); // will redirect to /cli/tests/ assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); const body = await response.text(); - assert(body.includes("Directory listing for /tests/")); + assert(body.includes("Directory listing for /cli/tests/")); }); // The feature below is not implemented, but the test should work after implementation @@ -165,7 +165,7 @@ testPerm({ net: true }, async function fetchWithRelativeRedirection(): Promise< testPerm({ net: true }, async function fetchWithInfRedirection(): Promise< void > { - const response = await fetch("http://localhost:4549/tests"); // will redirect to the same place + const response = await fetch("http://localhost:4549/cli/tests"); // will redirect to the same place assertEquals(response.status, 0); // network error }); */ diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts index fca9a38593b32453617e98dc24ffc277b008805e..8f4beb085fc0bc1ff627b5f98ad1bb6e14ec7003 100644 --- a/cli/js/files_test.ts +++ b/cli/js/files_test.ts @@ -24,7 +24,7 @@ testPerm({ read: true }, async function filesCopyToStdout(): Promise { }); testPerm({ read: true }, async function filesToAsyncIterator(): Promise { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -297,7 +297,7 @@ testPerm( ); testPerm({ read: true }, async function seekStart(): Promise { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward await file.read(new Uint8Array(1)); // "H" @@ -310,7 +310,7 @@ testPerm({ read: true }, async function seekStart(): Promise { }); testPerm({ read: true }, function seekSyncStart(): void { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward file.readSync(new Uint8Array(1)); // "H" @@ -323,7 +323,7 @@ testPerm({ read: true }, function seekSyncStart(): void { }); testPerm({ read: true }, async function seekCurrent(): Promise { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward await file.read(new Uint8Array(1)); // "H" @@ -336,7 +336,7 @@ testPerm({ read: true }, async function seekCurrent(): Promise { }); testPerm({ read: true }, function seekSyncCurrent(): void { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward file.readSync(new Uint8Array(1)); // "H" @@ -349,7 +349,7 @@ testPerm({ read: true }, function seekSyncCurrent(): void { }); testPerm({ read: true }, async function seekEnd(): Promise { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = await Deno.open(filename); await file.seek(-6, Deno.SeekMode.SEEK_END); const buf = new Uint8Array(6); @@ -359,7 +359,7 @@ testPerm({ read: true }, async function seekEnd(): Promise { }); testPerm({ read: true }, function seekSyncEnd(): void { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = Deno.openSync(filename); file.seekSync(-6, Deno.SeekMode.SEEK_END); const buf = new Uint8Array(6); @@ -369,7 +369,7 @@ testPerm({ read: true }, function seekSyncEnd(): void { }); testPerm({ read: true }, async function seekMode(): Promise { - const filename = "tests/hello.txt"; + const filename = "cli/tests/hello.txt"; const file = await Deno.open(filename); let err; try { diff --git a/cli/js/read_dir_test.ts b/cli/js/read_dir_test.ts index 8cc66caeefbf70fa3b1e7b55a6debef14ddd2fa1..77d2cbfe256d60295ffb5dc92de59b7bb01bfe80 100644 --- a/cli/js/read_dir_test.ts +++ b/cli/js/read_dir_test.ts @@ -13,7 +13,7 @@ function assertSameContent(files: FileInfo[]): void { } if (file.name === "002_hello.ts") { - assertEquals(file.mode!, Deno.statSync(`tests/${file.name}`).mode!); + assertEquals(file.mode!, Deno.statSync(`cli/tests/${file.name}`).mode!); counter++; } } @@ -22,7 +22,7 @@ function assertSameContent(files: FileInfo[]): void { } testPerm({ read: true }, function readDirSyncSuccess(): void { - const files = Deno.readDirSync("tests/"); + const files = Deno.readDirSync("cli/tests/"); assertSameContent(files); }); @@ -67,7 +67,7 @@ testPerm({ read: true }, function readDirSyncNotFound(): void { }); testPerm({ read: true }, async function readDirSuccess(): Promise { - const files = await Deno.readDir("tests/"); + const files = await Deno.readDir("cli/tests/"); assertSameContent(files); }); diff --git a/cli/js/resources_test.ts b/cli/js/resources_test.ts index 8807270278b877f3759c079bd8fd1cf7a92e4397..367b66217f62a5c01c2ee6856dd42c7580415c9d 100644 --- a/cli/js/resources_test.ts +++ b/cli/js/resources_test.ts @@ -31,7 +31,7 @@ testPerm({ net: true }, async function resourcesNet(): Promise { testPerm({ read: true }, async function resourcesFile(): Promise { const resourcesBefore = Deno.resources(); - await Deno.open("tests/hello.txt"); + await Deno.open("cli/tests/hello.txt"); const resourcesAfter = Deno.resources(); // check that exactly one new resource (file) was added diff --git a/cli/js/stat_test.ts b/cli/js/stat_test.ts index 7b4f06114bd7574d8cd75c488c4612dafcae01e7..9b03c0ece3067090c0137493344fbb096f8b69f2 100644 --- a/cli/js/stat_test.ts +++ b/cli/js/stat_test.ts @@ -12,7 +12,7 @@ testPerm({ read: true }, async function statSyncSuccess(): Promise { assert(modulesInfo.isDirectory()); assert(!modulesInfo.isSymlink()); - const testsInfo = Deno.statSync("tests"); + const testsInfo = Deno.statSync("cli/tests"); assert(testsInfo.isDirectory()); assert(!testsInfo.isSymlink()); }); @@ -96,7 +96,7 @@ testPerm({ read: true }, async function statSuccess(): Promise { assert(modulesInfo.isDirectory()); assert(!modulesInfo.isSymlink()); - const i = await Deno.stat("tests"); + const i = await Deno.stat("cli/tests"); assert(i.isDirectory()); assert(!i.isSymlink()); }); diff --git a/cli/source_maps.rs b/cli/source_maps.rs index e326c644e7900f62fe6ff72e2e51eee3c6886ac0..6b177cc696e12ee69992aeea73a160f7fee3a274 100644 --- a/cli/source_maps.rs +++ b/cli/source_maps.rs @@ -436,12 +436,12 @@ mod tests { #[test] fn source_map_from_json() { - let json = r#"{"version":3,"file":"error_001.js","sourceRoot":"","sources":["file:///Users/rld/src/deno/tests/error_001.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACV,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,GAAG;IACV,GAAG,EAAE,CAAC;AACR,CAAC;AAED,GAAG,EAAE,CAAC"}"#; + let json = r#"{"version":3,"file":"error_001.js","sourceRoot":"","sources":["file:///Users/rld/src/deno/cli/tests/error_001.ts"],"names":[],"mappings":"AAAA,SAAS,GAAG;IACV,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,GAAG;IACV,GAAG,EAAE,CAAC;AACR,CAAC;AAED,GAAG,EAAE,CAAC"}"#; let sm = SourceMap::from_json(json).unwrap(); assert_eq!(sm.sources.len(), 1); assert_eq!( sm.sources[0], - "file:///Users/rld/src/deno/tests/error_001.ts" + "file:///Users/rld/src/deno/cli/tests/error_001.ts" ); let mapping = sm .mappings diff --git a/cli/tests/README.md b/cli/tests/README.md index fe907192692b94d445c87fb0d54288f8839a080a..831d2750f45d3835106e47b9d5451b0c35fb36c7 100644 --- a/cli/tests/README.md +++ b/cli/tests/README.md @@ -1,7 +1,3 @@ # Integration Tests This path contains integration tests. See integration_tests.rs for the index. - -TODO(ry) Currently //tests is a symlink to //cli/tests, to simplify transition. -In the future the symlink should be removed when all the many references have -been updated to the new path. diff --git a/cli/tests/error_003_typescript.ts.out b/cli/tests/error_003_typescript.ts.out index ee93bc8778aba4bf44a7449d5db26130d3139fbb..b5854c20f6bfad7b80d09749f26a3115a84063a8 100644 --- a/cli/tests/error_003_typescript.ts.out +++ b/cli/tests/error_003_typescript.ts.out @@ -2,7 +2,7 @@ The types of 'a.b.c().d' are incompatible between these types. Type 'number' is not assignable to type 'string'. -[WILDCARD]/tests/error_003_typescript.ts:20:1 +[WILDCARD]/cli/tests/error_003_typescript.ts:20:1 20 x = y; ^ diff --git a/cli/tests/error_015_dynamic_import_permissions.js b/cli/tests/error_015_dynamic_import_permissions.js index 3460ca787a9ea430e0da233699dc27998bcccaf1..197339c5e6af34785e252e1f0b63933e52e9db76 100644 --- a/cli/tests/error_015_dynamic_import_permissions.js +++ b/cli/tests/error_015_dynamic_import_permissions.js @@ -1,3 +1,3 @@ (async () => { - await import("http://localhost:4545/tests/subdir/mod4.js"); + await import("http://localhost:4545/cli/tests/subdir/mod4.js"); })(); diff --git a/cli/tests/error_015_dynamic_import_permissions.out b/cli/tests/error_015_dynamic_import_permissions.out index dcc913e2b76ede5f6ecaf58bd2dc1a7b1e6b48c7..7078ac61c0b1935264ca58c638aad1ae16e84200 100644 --- a/cli/tests/error_015_dynamic_import_permissions.out +++ b/cli/tests/error_015_dynamic_import_permissions.out @@ -1 +1 @@ -error: Uncaught TypeError: network access to "http://localhost:4545/tests/subdir/mod4.js", run again with the --allow-net flag +error: Uncaught TypeError: network access to "http://localhost:4545/cli/tests/subdir/mod4.js", run again with the --allow-net flag diff --git a/cli/tests/error_016_dynamic_import_permissions2.js b/cli/tests/error_016_dynamic_import_permissions2.js index 71c70815ce4cc077526dfb99e129f2144de6a976..34e1a43d2ddefc4dacba1c9c4b8b7da793ef8958 100644 --- a/cli/tests/error_016_dynamic_import_permissions2.js +++ b/cli/tests/error_016_dynamic_import_permissions2.js @@ -1,5 +1,5 @@ // If this is executed with --allow-net but not --allow-read the following // import should cause a permission denied error. (async () => { - await import("http://localhost:4545/tests/subdir/evil_remote_import.js"); + await import("http://localhost:4545/cli/tests/subdir/evil_remote_import.js"); })(); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index b7dfc4e35cd383ab16f407acaec1783b594ad5c2..d4cd57e096b310bc64459fd81ab257b5c904d76c 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -131,7 +131,7 @@ fn installer_test_remote_module_run() { DenoFlags::default(), Some(temp_dir.path().to_string_lossy().to_string()), "echo_test", - "http://localhost:4545/tests/echo.ts", + "http://localhost:4545/cli/tests/echo.ts", vec!["hello".to_string()], ) .expect("Failed to install"); diff --git a/cli/worker.rs b/cli/worker.rs index 84841c4c55ef66b55a6318eabd752a39ffdd9d35..6fb235ceb7ae793fa0181ad9af568450e3cbad6c 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -264,7 +264,7 @@ mod tests { let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() - .join("tests/esm_imports_a.js"); + .join("cli/tests/esm_imports_a.js"); let module_specifier = ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap(); let global_state = ThreadSafeGlobalState::new( @@ -436,7 +436,7 @@ mod tests { let p = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) .parent() .unwrap() - .join("tests/002_hello.ts"); + .join("cli/tests/002_hello.ts"); let module_specifier = ModuleSpecifier::resolve_url_or_path(&p.to_string_lossy()).unwrap(); let result = diff --git a/core/js_errors.rs b/core/js_errors.rs index 0b77945a63e5122ab8efed77d12a81dd869307d6..6cb86f72404e23893c6214aa47300ad73d59d280 100644 --- a/core/js_errors.rs +++ b/core/js_errors.rs @@ -306,7 +306,7 @@ mod tests { "line":2, "column":11, "functionName":"foo", - "scriptName":"/Users/rld/src/deno/tests/error_001.ts", + "scriptName":"/Users/rld/src/deno/cli/tests/error_001.ts", "isEval":true, "isConstructor":false, "isWasm":false @@ -319,7 +319,7 @@ mod tests { Some(StackFrame { line: 1, column: 10, - script_name: "/Users/rld/src/deno/tests/error_001.ts".to_string(), + script_name: "/Users/rld/src/deno/cli/tests/error_001.ts".to_string(), function_name: "foo".to_string(), is_eval: true, is_constructor: false, @@ -332,7 +332,7 @@ mod tests { fn stack_frame_from_json_value_2() { let v = serde_json::from_str::( r#"{ - "scriptName": "/Users/rld/src/deno/tests/error_001.ts", + "scriptName": "/Users/rld/src/deno/cli/tests/error_001.ts", "line": 2, "column": 11 }"#, @@ -343,7 +343,7 @@ mod tests { let f = r.unwrap(); assert_eq!(f.line, 1); assert_eq!(f.column, 10); - assert_eq!(f.script_name, "/Users/rld/src/deno/tests/error_001.ts"); + assert_eq!(f.script_name, "/Users/rld/src/deno/cli/tests/error_001.ts"); } #[test] @@ -356,7 +356,7 @@ mod tests { "line":2, "column":11, "functionName":"foo", - "scriptName":"/Users/rld/src/deno/tests/error_001.ts", + "scriptName":"/Users/rld/src/deno/cli/tests/error_001.ts", "isEval":true, "isConstructor":false, "isWasm":false @@ -364,7 +364,7 @@ mod tests { "line":5, "column":5, "functionName":"bar", - "scriptName":"/Users/rld/src/deno/tests/error_001.ts", + "scriptName":"/Users/rld/src/deno/cli/tests/error_001.ts", "isEval":true, "isConstructor":false, "isWasm":false @@ -380,7 +380,7 @@ mod tests { StackFrame { line: 1, column: 10, - script_name: "/Users/rld/src/deno/tests/error_001.ts".to_string(), + script_name: "/Users/rld/src/deno/cli/tests/error_001.ts".to_string(), function_name: "foo".to_string(), is_eval: true, is_constructor: false, diff --git a/tests b/tests deleted file mode 120000 index 0e706053cf57e63580cd72e7a40e152ff89808d7..0000000000000000000000000000000000000000 --- a/tests +++ /dev/null @@ -1 +0,0 @@ -cli/tests \ No newline at end of file diff --git a/tools/benchmark.py b/tools/benchmark.py index a0e12fa48de0fbf86d7c6293b466507b0bed0d7a..c29ca3e8cac9ff85d1657daf2e51b24906197160 100755 --- a/tools/benchmark.py +++ b/tools/benchmark.py @@ -20,13 +20,13 @@ import http_server # The list of the tuples of the benchmark name and arguments exec_time_benchmarks = [ - ("hello", ["tests/002_hello.ts"]), - ("relative_import", ["tests/003_relative_import.ts"]), - ("error_001", ["tests/error_001.ts"]), - ("cold_hello", ["--reload", "tests/002_hello.ts"]), - ("cold_relative_import", ["--reload", "tests/003_relative_import.ts"]), - ("workers_startup", ["tests/workers_startup_bench.ts"]), - ("workers_round_robin", ["tests/workers_round_robin_bench.ts"]), + ("hello", ["cli/tests/002_hello.ts"]), + ("relative_import", ["cli/tests/003_relative_import.ts"]), + ("error_001", ["cli/tests/error_001.ts"]), + ("cold_hello", ["--reload", "cli/tests/002_hello.ts"]), + ("cold_relative_import", ["--reload", "cli/tests/003_relative_import.ts"]), + ("workers_startup", ["cli/tests/workers_startup_bench.ts"]), + ("workers_round_robin", ["cli/tests/workers_round_robin_bench.ts"]), ("text_decoder", ["cli/tests/text_decoder_perf.js"]), ("text_encoder", ["cli/tests/text_encoder_perf.js"]), ] diff --git a/tools/deno_dir_test.py b/tools/deno_dir_test.py index c8f98bad11c05936e844894d9de0cd6b17c3a742..9e11b8e3b28cdf777fcef5a42856862eed526c2b 100755 --- a/tools/deno_dir_test.py +++ b/tools/deno_dir_test.py @@ -40,7 +40,7 @@ class TestDenoDir(DenoTestCase): def run_deno(self, deno_dir=None): cmd = [ self.deno_exe, "run", - "http://localhost:4545/tests/subdir/print_hello.ts" + "http://localhost:4545/cli/tests/subdir/print_hello.ts" ] deno_dir_env = {"DENO_DIR": deno_dir} if deno_dir is not None else None res = run_output(cmd, quiet=True, env=deno_dir_env) diff --git a/tools/fetch_test.py b/tools/fetch_test.py index 8bff017d3f7cfcce642bf36790f245bc414992c3..4dad99b148de98b9bb6dc3a6f0945c724e7e1aa5 100755 --- a/tools/fetch_test.py +++ b/tools/fetch_test.py @@ -23,7 +23,7 @@ class TestFetch(DenoTestCase): os.path.exists( os.path.join( deno_dir, - "deps/http/localhost_PORT4545/tests/subdir/mod2.ts")) + "deps/http/localhost_PORT4545/cli/tests/subdir/mod2.ts")) finally: shutil.rmtree(deno_dir) diff --git a/tools/http_server.py b/tools/http_server.py index 9b929c15e58e42cf36e26b7923624fc5a7fa161a..871888a4e67eaac7ef705dc2e2466c4b08e2e1f7 100755 --- a/tools/http_server.py +++ b/tools/http_server.py @@ -223,7 +223,7 @@ def redirect_server(): # BUT with an extra subdir path def another_redirect_server(): return base_redirect_server( - ANOTHER_REDIRECT_PORT, PORT, extra_path_segment="/tests/subdir") + ANOTHER_REDIRECT_PORT, PORT, extra_path_segment="/cli/tests/subdir") # redirect server that points to another redirect server diff --git a/tools/repl_test.py b/tools/repl_test.py index 1c4441ebc66c0b0b71ab468deeaecf28874f330c..aae8a558f600607c2485288df696d8475481a7ea 100644 --- a/tools/repl_test.py +++ b/tools/repl_test.py @@ -114,7 +114,7 @@ class TestRepl(DenoTestCase): # def test_async_op(self): # out, err, code = self.input( - # "fetch('http://localhost:4545/tests/001_hello.js')" + + # "fetch('http://localhost:4545/cli/tests/001_hello.js')" + # ".then(res => res.text()).then(console.log)", # sleep=1) # self.assertEqual(out, 'Promise {}\nconsole.log("Hello World");\n\n') diff --git a/tools/target_test.py b/tools/target_test.py index 5a273423e0dd1800e5c77bf78c95b8217b994908..2df09f9ebaed2efe0a9c7717f80d0c319f7145a8 100644 --- a/tools/target_test.py +++ b/tools/target_test.py @@ -34,7 +34,7 @@ class TestTarget(DenoTestCase): def test_exec_path(self): cmd = [ self.deno_exe, "run", "--allow-run", "--allow-env", - "tests/exec_path.ts" + "cli/tests/exec_path.ts" ] result = run_output(cmd, quiet=True) print "exec_path", result diff --git a/tools/throughput_benchmark.py b/tools/throughput_benchmark.py index ba80b9909989a9fdf8851976e937fab80c1cc8d7..8b1de13d4686a61432482a89679dc0955ffbf1f6 100755 --- a/tools/throughput_benchmark.py +++ b/tools/throughput_benchmark.py @@ -21,7 +21,7 @@ def cat(deno_exe, megs): size = megs * MB start = time.time() cmd = deno_exe + " run --allow-read " - cmd += "tests/cat.ts /dev/zero | head -c %s " % size + cmd += "cli/tests/cat.ts /dev/zero | head -c %s " % size print cmd subprocess.check_output(cmd, shell=True) end = time.time() @@ -32,7 +32,7 @@ def tcp(deno_exe, megs): size = megs * MB # Run deno echo server in the background. args = [ - deno_exe, "run", "--allow-net", "tests/echo_server.ts", SERVER_ADDR + deno_exe, "run", "--allow-net", "cli/tests/echo_server.ts", SERVER_ADDR ] print args echo_server = subprocess.Popen(args) diff --git a/tools/util.py b/tools/util.py index c54158f9b155d428959ff42b1ad6f656d208f3a8..d49af71ce92fff50dece05645dce0e58ab2f06e9 100644 --- a/tools/util.py +++ b/tools/util.py @@ -21,7 +21,7 @@ executable_suffix = ".exe" if os.name == "nt" else "" root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) libdeno_path = os.path.join(root_path, "core", "libdeno") -tests_path = os.path.join(root_path, "tests") +tests_path = os.path.join(root_path, "cli/tests") third_party_path = os.path.join(root_path, "third_party")