summaryrefslogtreecommitdiff
path: root/test_util/src
diff options
context:
space:
mode:
Diffstat (limited to 'test_util/src')
-rw-r--r--test_util/src/lib.rs10
-rw-r--r--test_util/src/lsp.rs5
2 files changed, 15 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index b5d509945..5bbccacd8 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -49,6 +49,7 @@ use tokio::net::TcpStream;
use tokio_rustls::rustls;
use tokio_rustls::TlsAcceptor;
use tokio_tungstenite::accept_async;
+use url::Url;
pub mod assertions;
pub mod lsp;
@@ -120,10 +121,19 @@ pub fn napi_tests_path() -> PathBuf {
root_path().join("test_napi")
}
+/// Test server registry url.
+pub fn npm_registry_url() -> String {
+ "http://localhost:4545/npm/registry/".to_string()
+}
+
pub fn std_path() -> PathBuf {
root_path().join("test_util").join("std")
}
+pub fn std_file_url() -> String {
+ Url::from_directory_path(std_path()).unwrap().to_string()
+}
+
pub fn target_dir() -> PathBuf {
let current_exe = std::env::current_exe().unwrap();
let target_dir = current_exe.parent().unwrap().parent().unwrap();
diff --git a/test_util/src/lsp.rs b/test_util/src/lsp.rs
index c61793f98..c0fd8ff1b 100644
--- a/test_util/src/lsp.rs
+++ b/test_util/src/lsp.rs
@@ -1,5 +1,8 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+use crate::npm_registry_url;
+use crate::std_file_url;
+
use super::new_deno_dir;
use super::TempDir;
@@ -230,6 +233,8 @@ impl LspClient {
let mut command = Command::new(deno_exe);
command
.env("DENO_DIR", deno_dir.path())
+ .env("DENO_NODE_COMPAT_URL", std_file_url())
+ .env("DENO_NPM_REGISTRY", npm_registry_url())
.arg("lsp")
.stdin(Stdio::piped())
.stdout(Stdio::piped());