diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/cache_tests.rs | 4 | ||||
-rw-r--r-- | tests/integration/compile_tests.rs | 4 | ||||
-rw-r--r-- | tests/integration/npm_tests.rs | 78 | ||||
-rw-r--r-- | tests/integration/run_tests.rs | 27 | ||||
-rw-r--r-- | tests/integration/vendor_tests.rs | 54 |
5 files changed, 77 insertions, 90 deletions
diff --git a/tests/integration/cache_tests.rs b/tests/integration/cache_tests.rs index 5711b0f2e..120b06474 100644 --- a/tests/integration/cache_tests.rs +++ b/tests/integration/cache_tests.rs @@ -39,8 +39,8 @@ fn cache_matching_package_json_dep_should_not_install_all() { .args("cache npm:@types/node@18.8.2") .run(); output.assert_matches_text(concat!( - "Download http://localhost:4545/npm/registry/@types/node\n", - "Download http://localhost:4545/npm/registry/@types/node/node-18.8.2.tgz\n", + "Download http://localhost:4558/@types/node\n", + "Download http://localhost:4558/@types/node/node-18.8.2.tgz\n", "Initialize @types/node@18.8.2\n", )); } diff --git a/tests/integration/compile_tests.rs b/tests/integration/compile_tests.rs index 898a7d9f9..c20f8e66a 100644 --- a/tests/integration/compile_tests.rs +++ b/tests/integration/compile_tests.rs @@ -1083,8 +1083,8 @@ console.log(getValue());"#, .run(); output.assert_exit_code(0); output.assert_matches_text( - r#"Download http://localhost:4545/npm/registry/@denotest/esm-basic -Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz + r#"Download http://localhost:4558/@denotest/esm-basic +Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz Initialize @denotest/esm-basic@1.0.0 Check file:///[WILDCARD]/main.ts Compile file:///[WILDCARD]/main.ts to [WILDCARD] diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index 3bfd62680..cdad7462e 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -921,9 +921,7 @@ fn node_modules_dir_cache() { let package_global_cache_dir = deno_dir .path() .join("npm") - .join("localhost_4545") - .join("npm") - .join("registry") + .join("localhost_4558") .join("@denotest") .join("dual-cjs-esm") .join("1.0.0"); @@ -953,7 +951,7 @@ fn node_modules_dir_cache() { #[test] fn ensure_registry_files_local() { // ensures the registry files all point at local tarballs - let registry_dir_path = util::testdata_path().join("npm").join("registry"); + let registry_dir_path = util::tests_path().join("registry").join("npm"); for entry in std::fs::read_dir(®istry_dir_path).unwrap() { let entry = entry.unwrap(); if entry.metadata().unwrap().is_dir() { @@ -1509,7 +1507,7 @@ fn auto_discover_lock_file() { .run(); output .assert_matches_text( -r#"Download http://localhost:4545/npm/registry/@denotest/bin +r#"Download http://localhost:4558/@denotest/bin error: Integrity check failed for package: "npm:@denotest/bin@1.0.0". Unable to verify that the package is the same as when the lockfile was generated. @@ -1548,9 +1546,7 @@ fn peer_deps_with_copied_folders_and_lockfile() { let grandchild_path = deno_dir .path() .join("npm") - .join("localhost_4545") - .join("npm") - .join("registry") + .join("localhost_4558") .join("@denotest") .join("peer-dep-test-grandchild"); assert!(grandchild_path.join("1.0.0").exists()); @@ -1664,8 +1660,8 @@ itest!(non_existent_dep { exit_code: 1, output_str: Some(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/non-existent-dep\n", - "Download http://localhost:4545/npm/registry/@denotest/non-existent\n", + "Download http://localhost:4558/@denotest/non-existent-dep\n", + "Download http://localhost:4558/@denotest/non-existent\n", "[UNORDERED_END]\n", "error: npm package '@denotest/non-existent' does not exist.\n" )), @@ -1678,14 +1674,14 @@ itest!(non_existent_dep_version { exit_code: 1, output_str: Some(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/non-existent-dep-version\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/non-existent-dep-version\n", + "Download http://localhost:4558/@denotest/esm-basic\n", "[UNORDERED_END]\n", // does two downloads because when failing once it max tries to // get the latest version a second time "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/non-existent-dep-version\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/non-existent-dep-version\n", + "Download http://localhost:4558/@denotest/esm-basic\n", "[UNORDERED_END]\n", "error: Could not find npm package '@denotest/esm-basic' matching '=99.99.99'.\n" )), @@ -1710,7 +1706,7 @@ fn reload_info_not_found_cache_but_exists_remote() { version: &str, ) { let registry_json_path = - format!("npm/localhost_4545/npm/registry/{}/registry.json", package); + format!("npm/localhost_4558/{}/registry.json", package); let mut registry_json: Value = serde_json::from_str(&deno_dir.read_to_string(®istry_json_path)) .unwrap(); @@ -1747,12 +1743,12 @@ fn reload_info_not_found_cache_but_exists_remote() { .run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export/1.0.0.tgz\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default/1.0.0.tgz\n", + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/cjs-default-export/1.0.0.tgz\n", + "Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default/1.0.0.tgz\n", "[UNORDERED_END]\n", )); @@ -1777,8 +1773,8 @@ fn reload_info_not_found_cache_but_exists_remote() { let output = test_context.new_command().args("run main.ts").run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", "[UNORDERED_END]\n", "Node esm importing node cjs\n[WILDCARD]", )); @@ -1809,8 +1805,8 @@ fn reload_info_not_found_cache_but_exists_remote() { let output = test_context.new_command().args("run main.ts").run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", "[UNORDERED_END]\n", "Node esm importing node cjs\n[WILDCARD]", )); @@ -1847,8 +1843,8 @@ fn reload_info_not_found_cache_but_exists_remote() { let output = test_context.new_command().args("run main.ts").run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", "[UNORDERED_END]\n", "[UNORDERED_START]\n", "Initialize @denotest/cjs-default-export@1.0.0\n", @@ -1884,9 +1880,9 @@ fn reload_info_not_found_cache_but_exists_remote() { let output = test_context.new_command().args("run main.ts").run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", "[UNORDERED_END]\n", "Initialize @denotest/esm-basic@1.0.0\n", "Node esm importing node cjs\n[WILDCARD]", @@ -1922,9 +1918,9 @@ fn reload_info_not_found_cache_but_exists_remote() { let output = test_context.new_command().args("run main.ts").run(); output.assert_matches_text(concat!( "[UNORDERED_START]\n", - "Download http://localhost:4545/npm/registry/@denotest/cjs-default-export\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-import-cjs-default\n", + "Download http://localhost:4558/@denotest/cjs-default-export\n", + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-import-cjs-default\n", "[UNORDERED_END]\n", "Node esm importing node cjs\n[WILDCARD]", )); @@ -2103,13 +2099,11 @@ fn top_level_install_package_json_explicit_opt_in() { temp_dir.write("main.ts", "console.log(5);"); let output = test_context.new_command().args("cache main.ts").run(); - output.assert_matches_text( - concat!( - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz\n", - "Initialize @denotest/esm-basic@1.0.0\n", - ) - ); + output.assert_matches_text(concat!( + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz\n", + "Initialize @denotest/esm-basic@1.0.0\n", + )); rm_created_files(); let output = test_context @@ -3093,9 +3087,7 @@ async fn test_private_npm_registry() { let client = reqwest::Client::new(); - let url = - Url::parse("http://127.0.0.1:4252/npm/registry/@denotest/bin/0.5.0") - .unwrap(); + let url = Url::parse("http://127.0.0.1:4559/@denotest2/basic").unwrap(); let req = reqwest::Request::new(reqwest::Method::GET, url.clone()); let resp = client.execute(req).await.unwrap(); diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index 5e5d6935c..5e9d00a67 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -975,12 +975,11 @@ fn lock_redirects() { .new_command() .args("run main.ts Hi there") .run() - .assert_matches_text( - concat!( - "Download http://localhost:4545/echo.ts\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz\n", - "Hi, there", + .assert_matches_text(concat!( + "Download http://localhost:4545/echo.ts\n", + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz\n", + "Hi, there", )); util::assertions::assert_wildcard_match( &temp_dir.read_to_string("deno.lock"), @@ -5217,7 +5216,7 @@ fn code_cache_npm_test() { output .assert_stdout_matches_text("Hello World[WILDCARD]") .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/main.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/npm/registry/chalk/5.[WILDCARD]/source/index.js[WILDCARD]"); + .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/chalk/5.[WILDCARD]/source/index.js[WILDCARD]"); assert!(!output.stderr().contains("V8 code cache hit")); // Check that the code cache database exists. @@ -5241,7 +5240,7 @@ fn code_cache_npm_test() { output .assert_stdout_matches_text("Hello World[WILDCARD]") .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/main.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/npm/registry/chalk/5.[WILDCARD]/source/index.js[WILDCARD]"); + .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/chalk/5.[WILDCARD]/source/index.js[WILDCARD]"); assert!(!output.stderr().contains("Updating V8 code cache")); } } @@ -5275,9 +5274,9 @@ fn code_cache_npm_with_require_test() { output .assert_stdout_matches_text("function[WILDCARD]") .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/main.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/npm/registry/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for script: file:///[WILDCARD]/npm/registry/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for script: file:///[WILDCARD]/npm/registry/browserslist/[WILDCARD]/index.js[WILDCARD]"); + .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for ES module: file:///[WILDCARD]/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") + .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for script: file:///[WILDCARD]/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") + .assert_stderr_matches_text("[WILDCARD]Updating V8 code cache for script: file:///[WILDCARD]/browserslist/[WILDCARD]/index.js[WILDCARD]"); assert!(!output.stderr().contains("V8 code cache hit")); // Check that the code cache database exists. @@ -5301,9 +5300,9 @@ fn code_cache_npm_with_require_test() { output .assert_stdout_matches_text("function[WILDCARD]") .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/main.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/npm/registry/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for script: file:///[WILDCARD]/npm/registry/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") - .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for script: file:///[WILDCARD]/npm/registry/browserslist/[WILDCARD]/index.js[WILDCARD]"); + .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for ES module: file:///[WILDCARD]/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") + .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for script: file:///[WILDCARD]/autoprefixer/[WILDCARD]/autoprefixer.js[WILDCARD]") + .assert_stderr_matches_text("[WILDCARD]V8 code cache hit for script: file:///[WILDCARD]/browserslist/[WILDCARD]/index.js[WILDCARD]"); assert!(!output.stderr().contains("Updating V8 code cache")); } } diff --git a/tests/integration/vendor_tests.rs b/tests/integration/vendor_tests.rs index ce6aa7044..7067ac592 100644 --- a/tests/integration/vendor_tests.rs +++ b/tests/integration/vendor_tests.rs @@ -576,22 +576,20 @@ fn vendor_npm_node_specifiers() { temp_dir.write("deno.json", "{}"); let output = context.new_command().args("vendor my_app.ts").run(); - output.assert_matches_text( - format!( - concat!( - "Download http://localhost:4545/vendor/npm_and_node_specifier.ts\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz\n", - "{}\n", - "Initialize @denotest/esm-basic@1.0.0\n", - "{}\n\n", - "{}\n", - ), - vendored_text("1 module", "vendor/"), - vendored_npm_package_text("1 npm package"), - success_text_updated_deno_json("vendor/") - ) - ); + output.assert_matches_text(format!( + concat!( + "Download http://localhost:4545/vendor/npm_and_node_specifier.ts\n", + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz\n", + "{}\n", + "Initialize @denotest/esm-basic@1.0.0\n", + "{}\n\n", + "{}\n", + ), + vendored_text("1 module", "vendor/"), + vendored_npm_package_text("1 npm package"), + success_text_updated_deno_json("vendor/") + )); let output = context.new_command().args("run -A my_app.ts").run(); output.assert_matches_text("true 5\n"); assert!(temp_dir.path().join("node_modules").exists()); @@ -652,19 +650,17 @@ fn vendor_only_npm_specifiers() { temp_dir.write("deno.json", "{}"); let output = context.new_command().args("vendor my_app.ts").run(); - output.assert_matches_text( - format!( - concat!( - "Download http://localhost:4545/npm/registry/@denotest/esm-basic\n", - "Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz\n", - "{}\n", - "Initialize @denotest/esm-basic@1.0.0\n", - "{}\n", - ), - vendored_text("0 modules", "vendor/"), - vendored_npm_package_text("1 npm package"), - ) - ); + output.assert_matches_text(format!( + concat!( + "Download http://localhost:4558/@denotest/esm-basic\n", + "Download http://localhost:4558/@denotest/esm-basic/1.0.0.tgz\n", + "{}\n", + "Initialize @denotest/esm-basic@1.0.0\n", + "{}\n", + ), + vendored_text("0 modules", "vendor/"), + vendored_npm_package_text("1 npm package"), + )); } fn success_text(module_count: &str, dir: &str, has_import_map: bool) -> String { |