summaryrefslogtreecommitdiff
path: root/tests/util/server/src/npm.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/server/src/npm.rs')
-rw-r--r--tests/util/server/src/npm.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/util/server/src/npm.rs b/tests/util/server/src/npm.rs
index f1c341738..31686fa85 100644
--- a/tests/util/server/src/npm.rs
+++ b/tests/util/server/src/npm.rs
@@ -18,6 +18,7 @@ use crate::PathRef;
pub const DENOTEST_SCOPE_NAME: &str = "@denotest";
pub const DENOTEST2_SCOPE_NAME: &str = "@denotest2";
+pub const DENOTEST3_SCOPE_NAME: &str = "@denotest3";
pub static PUBLIC_TEST_NPM_REGISTRY: Lazy<TestNpmRegistry> = Lazy::new(|| {
TestNpmRegistry::new(
@@ -54,6 +55,18 @@ pub static PRIVATE_TEST_NPM_REGISTRY_2: Lazy<TestNpmRegistry> =
)
});
+pub static PRIVATE_TEST_NPM_REGISTRY_3: Lazy<TestNpmRegistry> =
+ Lazy::new(|| {
+ TestNpmRegistry::new(
+ NpmRegistryKind::Private,
+ &format!(
+ "http://localhost:{}",
+ crate::servers::PRIVATE_NPM_REGISTRY_3_PORT
+ ),
+ "npm-private3",
+ )
+ });
+
pub enum NpmRegistryKind {
Public,
Private,
@@ -161,6 +174,17 @@ impl TestNpmRegistry {
return Some((DENOTEST2_SCOPE_NAME, package_name_with_path));
}
+ let prefix1 = format!("/{}/", DENOTEST3_SCOPE_NAME);
+ let prefix2 = format!("/{}%2f", DENOTEST3_SCOPE_NAME);
+
+ let maybe_package_name_with_path = uri_path
+ .strip_prefix(&prefix1)
+ .or_else(|| uri_path.strip_prefix(&prefix2));
+
+ if let Some(package_name_with_path) = maybe_package_name_with_path {
+ return Some((DENOTEST3_SCOPE_NAME, package_name_with_path));
+ }
+
None
}
}