summaryrefslogtreecommitdiff
path: root/tests/integration/npm_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-05-06 21:06:01 -0400
committerGitHub <noreply@github.com>2024-05-07 01:06:01 +0000
commit1587387bccb6dbecd85f5141dd7543f013d47cd8 (patch)
treeb9829c3e50442deff360cf664555935a0d16a4db /tests/integration/npm_tests.rs
parent87d1ead7d09638172b0e397c8209c759666514da (diff)
chore(test): move npm registries to separate servers and to the `tests/registry` folder (#23717)
1. Moves the npm registries to their own dedicated ports. 2. Moves the data files out of `tests/testdata/npm/registry` to `tests/registry/npm`.
Diffstat (limited to 'tests/integration/npm_tests.rs')
-rw-r--r--tests/integration/npm_tests.rs78
1 files changed, 35 insertions, 43 deletions
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(&registry_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(&registry_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();