summaryrefslogtreecommitdiff
path: root/test_util/src/lib.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-08-29 13:02:54 -0600
committerGitHub <noreply@github.com>2023-08-29 13:02:54 -0600
commit64045ebc7a4e1c9f77204ffe35563134a453a7c6 (patch)
treec6710acf89e7019fd203d1667edc1a7798850c1d /test_util/src/lib.rs
parent441b860978afd0160a459aee7e42ccc97263dc23 (diff)
chore(cli): use NPM_CONFIG_REGISTRY for all tests (#20320)
We never want tests to hit the real npm registry because this causes test flakes. In addition, we set a sentinal "unset" value for `NPM_CONFIG_REGISTRY` to ensure that all tests requiring npm go through the test server.
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r--test_util/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index cf66e3366..fa0cb8a84 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -160,6 +160,10 @@ pub fn npm_registry_url() -> String {
"http://localhost:4545/npm/registry/".to_string()
}
+pub fn npm_registry_unset_url() -> String {
+ "http://NPM_CONFIG_REGISTRY.is.unset".to_string()
+}
+
pub fn std_path() -> PathRef {
root_path().join("test_util").join("std")
}
@@ -2309,6 +2313,7 @@ pub fn deno_cmd_with_deno_dir(deno_dir: &TempDir) -> DenoCmd {
assert!(exe_path.exists());
let mut cmd = Command::new(exe_path);
cmd.env("DENO_DIR", deno_dir.path());
+ cmd.env("NPM_CONFIG_REGISTRY", npm_registry_unset_url());
DenoCmd {
_deno_dir: deno_dir.clone(),
cmd,