summaryrefslogtreecommitdiff
path: root/test_napi
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_napi
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_napi')
-rw-r--r--test_napi/tests/napi_tests.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/test_napi/tests/napi_tests.rs b/test_napi/tests/napi_tests.rs
index c3ce285e0..0b0c9d311 100644
--- a/test_napi/tests/napi_tests.rs
+++ b/test_napi/tests/napi_tests.rs
@@ -2,6 +2,8 @@
use std::process::Command;
use test_util::deno_cmd;
+use test_util::env_vars_for_npm_tests;
+use test_util::http_server;
#[cfg(debug_assertions)]
const BUILD_VARIANT: &str = "debug";
@@ -53,6 +55,7 @@ fn build() {
fn napi_tests() {
build();
+ let _http_guard = http_server();
let output = deno_cmd()
.current_dir(test_util::napi_tests_path())
.env("RUST_BACKTRACE", "1")
@@ -61,6 +64,7 @@ fn napi_tests() {
.arg("--allow-env")
.arg("--allow-ffi")
.arg("--allow-run")
+ .envs(env_vars_for_npm_tests())
.spawn()
.unwrap()
.wait_with_output()