summaryrefslogtreecommitdiff
path: root/cli/tests/integration/npm_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-08-25 20:24:18 -0400
committerGitHub <noreply@github.com>2022-08-25 20:24:18 -0400
commit376665d1154501660e7b20f760a0482509cff8b0 (patch)
tree0a979722c66f8ede48f1dff21c8ceb335521a94a /cli/tests/integration/npm_tests.rs
parent0fe590bbcbf270b50abd8d73db1c5e0be69591f1 (diff)
fix: avoid global declaration collisions in cjs (#15608)
* Use a default stack size * 2 in debug for Windows because swc using so much stack size. We should look into this more later though.
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r--cli/tests/integration/npm_tests.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 9c4b98241..c46f8e92b 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -6,8 +6,7 @@ use test_util as util;
use util::assert_contains;
use util::http_server;
-// NOTE: It's possible to automatically update the npm registry data in the test server
-// by setting the DENO_TEST_UTIL_UPDATE_NPM=1 environment variable.
+// NOTE: See how to make test npm packages at ../testdata/npm/README.md
itest!(esm_module {
args: "run --allow-read --unstable npm/esm/main.js",
@@ -48,6 +47,13 @@ itest!(cjs_sub_path {
http_server: true,
});
+itest!(cjs_local_global_decls {
+ args: "run --allow-read --unstable npm/cjs_local_global_decls/main.ts",
+ output: "npm/cjs_local_global_decls/main.out",
+ envs: env_vars(),
+ http_server: true,
+});
+
itest!(dynamic_import {
args: "run --allow-read --unstable npm/dynamic_import/main.ts",
output: "npm/dynamic_import/main.out",
@@ -238,12 +244,14 @@ fn ensure_registry_files_local() {
let registry_json_path = registry_dir_path
.join(entry.file_name())
.join("registry.json");
- let file_text = std::fs::read_to_string(&registry_json_path).unwrap();
- if file_text.contains("https://registry.npmjs.org/") {
- panic!(
- "file {} contained a reference to the npm registry",
- registry_json_path.display(),
- );
+ if registry_json_path.exists() {
+ let file_text = std::fs::read_to_string(&registry_json_path).unwrap();
+ if file_text.contains("https://registry.npmjs.org/") {
+ panic!(
+ "file {} contained a reference to the npm registry",
+ registry_json_path.display(),
+ );
+ }
}
}
}