summaryrefslogtreecommitdiff
path: root/cli/tests/integration/npm_tests.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-01-22 16:31:12 -0500
committerGitHub <noreply@github.com>2024-01-22 22:31:12 +0100
commit69d5f136badfd7cfa9b979ff2fee7caf397098ca (patch)
tree665c6686fbf6f0732d84984f5f48557e45b4c7b6 /cli/tests/integration/npm_tests.rs
parentd20c9e75d1540b1a27e721d0cf66d29ba6a2c3fb (diff)
feat(lockfile): track JSR and npm dependencies in config file (#22004)
See overview in https://github.com/denoland/deno_lockfile/pull/13
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r--cli/tests/integration/npm_tests.rs44
1 files changed, 22 insertions, 22 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index cfb1861b7..9840f2771 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -256,7 +256,7 @@ itest!(import_map {
http_server: true,
});
-itest!(lock_file {
+itest!(lock_file_integrity_failure {
args: "run --allow-read --allow-env --lock npm/lock_file/lock.json npm/lock_file/main.js",
output: "npm/lock_file/main.out",
envs: env_vars_for_npm_tests(),
@@ -1517,10 +1517,9 @@ fn lock_file_lock_write() {
#[test]
fn auto_discover_lock_file() {
- let _server = http_server();
+ let context = TestContextBuilder::for_npm().use_temp_cwd().build();
- let deno_dir = util::new_deno_dir();
- let temp_dir = util::TempDir::new();
+ let temp_dir = context.temp_dir();
// write empty config file
temp_dir.write("deno.json", "{}");
@@ -1541,25 +1540,26 @@ fn auto_discover_lock_file() {
}"#;
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_for_npm_tests())
- .piped_output()
- .spawn()
- .unwrap();
- let output = deno.wait_with_output().unwrap();
- assert!(!output.status.success());
- assert_eq!(output.status.code(), Some(10));
+ let output = context
+ .new_command()
+ .args("run --unstable -A npm:@denotest/bin/cli-esm test")
+ .run();
+ output
+ .assert_matches_text(
+r#"Download http://localhost:4545/npm/registry/@denotest/bin
+error: Integrity check failed for npm package: "@denotest/bin@1.0.0". Unable to verify that the package
+is the same as when the lockfile was generated.
- let stderr = String::from_utf8(output.stderr).unwrap();
- assert!(stderr.contains(
- "Integrity check failed for npm package: \"@denotest/bin@1.0.0\""
- ));
+Actual: sha512-[WILDCARD]
+Expected: sha512-foobar
+
+This could be caused by:
+ * the lock file may be corrupt
+ * the source itself may be corrupt
+
+Use "--lock-write" flag to regenerate the lockfile at "[WILDCARD]deno.lock".
+"#)
+ .assert_exit_code(10);
}
#[test]