summaryrefslogtreecommitdiff
path: root/cli/tests/integration
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/integration')
-rw-r--r--cli/tests/integration/npm_tests.rs48
-rw-r--r--cli/tests/integration/run_tests.rs13
2 files changed, 55 insertions, 6 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index a5b443171..72af72a76 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -998,6 +998,54 @@ fn lock_file_missing_top_level_package() {
);
}
+#[test]
+fn auto_discover_lock_file() {
+ let _server = http_server();
+
+ let deno_dir = util::new_deno_dir();
+ let temp_dir = util::TempDir::new();
+
+ // write empty config file
+ temp_dir.write("deno.json", "{}");
+
+ // write a lock file with borked integrity
+ let lock_file_content = r#"{
+ "version": "2",
+ "remote": {},
+ "npm": {
+ "specifiers": { "@denotest/bin": "@denotest/bin@1.0.0" },
+ "packages": {
+ "@denotest/bin@1.0.0": {
+ "integrity": "sha512-foobar",
+ "dependencies": {}
+ }
+ }
+ }
+ }"#;
+ temp_dir.write("deno.lock", lock_file_content);
+
+ let deno = util::deno_cmd_with_deno_dir(&deno_dir)
+ .current_dir(temp_dir.path())
+ .arg("run")
+ .arg("--unstable")
+ .arg("-A")
+ .arg("npm:@denotest/bin/cli-esm")
+ .arg("test")
+ .envs(env_vars())
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .spawn()
+ .unwrap();
+ let output = deno.wait_with_output().unwrap();
+ assert!(!output.status.success());
+ assert_eq!(output.status.code(), Some(10));
+
+ let stderr = String::from_utf8(output.stderr).unwrap();
+ assert!(stderr.contains(
+ "Integrity check failed for npm package: \"@denotest/bin@1.0.0\""
+ ));
+}
+
fn env_vars_no_sync_download() -> Vec<(String, String)> {
vec![
("DENO_NODE_COMPAT_URL".to_string(), util::std_file_url()),
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 99e122c69..68d15bfd9 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -609,12 +609,6 @@ itest!(private_field_presence_no_check {
output: "run/private_field_presence.ts.out",
});
-itest!(lock_write_requires_lock {
- args: "run --lock-write some_file.ts",
- output: "run/lock_write_requires_lock.out",
- exit_code: 1,
-});
-
// TODO(bartlomieju): remove --unstable once Deno.spawn is stabilized
itest!(lock_write_fetch {
args:
@@ -3634,3 +3628,10 @@ fn websocket_server_idletimeout() {
assert!(child.wait().unwrap().success());
}
+
+itest!(auto_discover_lockfile {
+ args: "run run/auto_discover_lockfile/main.ts",
+ output: "run/auto_discover_lockfile/main.out",
+ http_server: true,
+ exit_code: 10,
+});