diff options
Diffstat (limited to 'cli/tests/integration/npm_tests.rs')
-rw-r--r-- | cli/tests/integration/npm_tests.rs | 44 |
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] |