From 448fe67b7a2142f62332b651f9d215534dceb1f5 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 28 May 2024 14:58:43 -0400 Subject: feat(vendor): support modifying remote files in vendor folder without checksum errors (#23979) Includes: * https://github.com/denoland/deno_graph/pull/486 * https://github.com/denoland/deno_graph/pull/488 * https://github.com/denoland/deno_lockfile/pull/25 * https://github.com/denoland/deno_lockfile/pull/22 * https://github.com/denoland/deno_graph/pull/483 * https://github.com/denoland/deno_graph/pull/470 --- tests/integration/bundle_tests.rs | 7 - tests/integration/jsr_tests.rs | 70 +++++---- tests/integration/npm_tests.rs | 20 +-- tests/integration/run_tests.rs | 96 +----------- .../different-deps-per-export/1.0.0/add.ts | 1 + .../different-deps-per-export/1.0.0/subtract.ts | 1 + .../different-deps-per-export/1.0.0_meta.json | 6 + .../@denotest/different-deps-per-export/meta.json | 5 + tests/registry/jsr/@denotest/subtract/1.0.0/mod.ts | 3 + .../jsr/@denotest/subtract/1.0.0_meta.json | 8 + tests/registry/jsr/@denotest/subtract/meta.json | 5 + tests/registry/npm/@denotest/add/1.0.0/index.d.ts | 1 + tests/registry/npm/@denotest/add/1.0.0/index.js | 1 + .../registry/npm/@denotest/add/1.0.0/package.json | 4 + .../npm/@denotest/subtract/1.0.0/index.d.ts | 1 + .../registry/npm/@denotest/subtract/1.0.0/index.js | 1 + .../npm/@denotest/subtract/1.0.0/package.json | 4 + tests/specs/bundle/lockfile/__test__.jsonc | 5 + tests/specs/bundle/lockfile/check_error.json | 5 + tests/specs/bundle/lockfile/check_error.out | 12 ++ .../future_install_node_modules/corrupted.out | 2 +- tests/specs/jsr/version_not_found/main.out | 3 +- tests/specs/lockfile/adding_jsr_dep/__test__.jsonc | 16 ++ tests/specs/lockfile/adding_jsr_dep/add.ts | 1 + tests/specs/lockfile/adding_jsr_dep/deno.json | 9 ++ tests/specs/lockfile/adding_jsr_dep/lock01.out | 20 +++ tests/specs/lockfile/adding_jsr_dep/lock02.out | 24 +++ tests/specs/lockfile/adding_jsr_dep/subtract.ts | 1 + .../adding_jsr_export_new_dep/__test__.jsonc | 16 ++ .../lockfile/adding_jsr_export_new_dep/add.ts | 1 + .../lockfile/adding_jsr_export_new_dep/deno.json | 8 + .../lockfile/adding_jsr_export_new_dep/lock01.out | 26 ++++ .../lockfile/adding_jsr_export_new_dep/lock02.out | 31 ++++ .../lockfile/adding_jsr_export_new_dep/subtract.ts | 1 + tests/specs/lockfile/adding_npm_dep/__test__.jsonc | 16 ++ tests/specs/lockfile/adding_npm_dep/add.ts | 1 + tests/specs/lockfile/adding_npm_dep/deno.json | 9 ++ tests/specs/lockfile/adding_npm_dep/lock01.out | 21 +++ tests/specs/lockfile/adding_npm_dep/lock02.out | 26 ++++ tests/specs/lockfile/adding_npm_dep/subtract.ts | 1 + tests/specs/lockfile/adding_redirect/1.ts | 1 + tests/specs/lockfile/adding_redirect/2.ts | 1 + .../specs/lockfile/adding_redirect/__test__.jsonc | 16 ++ tests/specs/lockfile/adding_redirect/deno.json | 5 + tests/specs/lockfile/adding_redirect/lock01.out | 6 + tests/specs/lockfile/adding_redirect/lock02.out | 9 ++ .../lockfile/auto_discover_lockfile/__test__.jsonc | 5 + .../lockfile/auto_discover_lockfile/deno.json | 3 + .../lockfile/auto_discover_lockfile/deno.lock | 7 + .../specs/lockfile/auto_discover_lockfile/main.out | 13 ++ .../specs/lockfile/auto_discover_lockfile/main.ts | 1 + .../lockfile/checksum_at_redirect/__test__.jsonc | 5 + .../specs/lockfile/checksum_at_redirect/deno.json | 2 + .../specs/lockfile/checksum_at_redirect/deno.lock | 6 + tests/specs/lockfile/checksum_at_redirect/run.out | 12 ++ .../config_file_lock_boolean/__test__.jsonc | 13 ++ .../lockfile/config_file_lock_boolean/deno.lock | 7 + .../lockfile/config_file_lock_boolean/false.json | 3 + .../config_file_lock_boolean/false.main.out | 2 + .../lockfile/config_file_lock_boolean/main.ts | 1 + .../lockfile/config_file_lock_boolean/true.json | 3 + .../config_file_lock_boolean/true.main.out | 11 ++ .../config_file_lock_path/019_media_types.ts.out | 1 + .../lockfile/config_file_lock_path/__test__.jsonc | 13 ++ .../config_file_lock_path.json | 3 + .../config_file_lock_path.out | 11 ++ .../config_file_lock_path/lock_check_err2.json | 10 ++ .../config_file_lock_path/lock_check_err2.out | 11 ++ .../config_file_lock_path/lock_check_ok2.json | 13 ++ .../config_file_lock_path/run/lock_check_ok2.json | 14 ++ tests/specs/lockfile/lock_check_err/__test__.jsonc | 5 + .../lockfile/lock_check_err/lock_check_err.json | 4 + .../lockfile/lock_check_err/lock_check_err.out | 11 ++ .../specs/lockfile/lock_check_err2/__test__.jsonc | 5 + .../lockfile/lock_check_err2/lock_check_err2.json | 10 ++ .../lockfile/lock_check_err2/lock_check_err2.out | 11 ++ .../lockfile/lock_dynamic_imports/__test__.jsonc | 5 + .../lock_dynamic_imports/lock_dynamic_imports.json | 6 + .../lock_dynamic_imports/lock_dynamic_imports.out | 12 ++ .../lockfile/lock_v2_check_err/__test__.jsonc | 5 + .../lock_v2_check_err/lock_v2_check_err.json | 7 + .../lock_v2_check_err/lock_v2_check_err.out | 11 ++ .../lockfile/lock_v2_check_err2/__test__.jsonc | 5 + .../lock_v2_check_err2/lock_v2_check_err2.json | 13 ++ .../lock_v2_check_err2/lock_v2_check_err2.out | 11 ++ .../lock_v2_dynamic_imports/__test__.jsonc | 5 + .../lock_v2_dynamic_imports.json | 9 ++ .../lock_v2_dynamic_imports.out | 12 ++ tests/specs/lockfile/no_lock/__test__.jsonc | 67 +++++---- tests/specs/lockfile/no_lock/bench.nolock.out | 1 + tests/specs/lockfile/no_lock/doc.nolock.out | 1 + tests/specs/lockfile/no_lock/fail.out | 15 +- tests/specs/lockfile/no_lock/fail_initial.out | 4 - tests/specs/lockfile/no_lock/info.nolock.out | 1 + tests/specs/lockfile/no_lock/test.nolock.out | 1 + .../npm/lock_file_integrity_failure/__test__.jsonc | 5 + .../npm/lock_file_integrity_failure/lock.json | 164 +++++++++++++++++++++ .../specs/npm/lock_file_integrity_failure/main.js | 5 + .../specs/npm/lock_file_integrity_failure/main.out | 12 ++ tests/testdata/bundle/lockfile/check_error.json | 5 - tests/testdata/bundle/lockfile/check_error.out | 4 - tests/testdata/fmt/invalid_data.out | 6 +- tests/testdata/npm/lock_file/lock.json | 164 --------------------- tests/testdata/npm/lock_file/main.js | 5 - tests/testdata/npm/lock_file/main.out | 12 -- .../testdata/run/auto_discover_lockfile/deno.json | 3 - .../testdata/run/auto_discover_lockfile/deno.lock | 7 - tests/testdata/run/auto_discover_lockfile/main.out | 5 - tests/testdata/run/auto_discover_lockfile/main.ts | 1 - .../run/config_file_lock_boolean/deno.lock | 7 - .../run/config_file_lock_boolean/false.json | 3 - .../run/config_file_lock_boolean/false.main.out | 2 - .../testdata/run/config_file_lock_boolean/main.ts | 1 - .../run/config_file_lock_boolean/true.json | 3 - .../run/config_file_lock_boolean/true.main.out | 3 - tests/testdata/run/config_file_lock_path.json | 3 - tests/testdata/run/config_file_lock_path.out | 3 - tests/testdata/run/lock_check_err.json | 4 - tests/testdata/run/lock_check_err.out | 3 - tests/testdata/run/lock_check_err2.json | 19 ++- tests/testdata/run/lock_check_err2.out | 3 - tests/testdata/run/lock_dynamic_imports.json | 6 - tests/testdata/run/lock_dynamic_imports.out | 4 - tests/testdata/run/lock_v2_check_err.json | 7 - tests/testdata/run/lock_v2_check_err.out | 3 - tests/testdata/run/lock_v2_check_err2.json | 13 -- tests/testdata/run/lock_v2_check_err2.out | 3 - tests/testdata/run/lock_v2_dynamic_imports.json | 9 -- tests/testdata/run/lock_v2_dynamic_imports.out | 4 - tests/util/server/src/builders.rs | 51 ++++++- tests/wpt/runner/expectation.json | 10 +- 131 files changed, 1001 insertions(+), 495 deletions(-) create mode 100644 tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/add.ts create mode 100644 tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/subtract.ts create mode 100644 tests/registry/jsr/@denotest/different-deps-per-export/1.0.0_meta.json create mode 100644 tests/registry/jsr/@denotest/different-deps-per-export/meta.json create mode 100644 tests/registry/jsr/@denotest/subtract/1.0.0/mod.ts create mode 100644 tests/registry/jsr/@denotest/subtract/1.0.0_meta.json create mode 100644 tests/registry/jsr/@denotest/subtract/meta.json create mode 100644 tests/registry/npm/@denotest/add/1.0.0/index.d.ts create mode 100644 tests/registry/npm/@denotest/add/1.0.0/index.js create mode 100644 tests/registry/npm/@denotest/add/1.0.0/package.json create mode 100644 tests/registry/npm/@denotest/subtract/1.0.0/index.d.ts create mode 100644 tests/registry/npm/@denotest/subtract/1.0.0/index.js create mode 100644 tests/registry/npm/@denotest/subtract/1.0.0/package.json create mode 100644 tests/specs/bundle/lockfile/__test__.jsonc create mode 100644 tests/specs/bundle/lockfile/check_error.json create mode 100644 tests/specs/bundle/lockfile/check_error.out create mode 100644 tests/specs/lockfile/adding_jsr_dep/__test__.jsonc create mode 100644 tests/specs/lockfile/adding_jsr_dep/add.ts create mode 100644 tests/specs/lockfile/adding_jsr_dep/deno.json create mode 100644 tests/specs/lockfile/adding_jsr_dep/lock01.out create mode 100644 tests/specs/lockfile/adding_jsr_dep/lock02.out create mode 100644 tests/specs/lockfile/adding_jsr_dep/subtract.ts create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/__test__.jsonc create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/add.ts create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/deno.json create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/lock01.out create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/lock02.out create mode 100644 tests/specs/lockfile/adding_jsr_export_new_dep/subtract.ts create mode 100644 tests/specs/lockfile/adding_npm_dep/__test__.jsonc create mode 100644 tests/specs/lockfile/adding_npm_dep/add.ts create mode 100644 tests/specs/lockfile/adding_npm_dep/deno.json create mode 100644 tests/specs/lockfile/adding_npm_dep/lock01.out create mode 100644 tests/specs/lockfile/adding_npm_dep/lock02.out create mode 100644 tests/specs/lockfile/adding_npm_dep/subtract.ts create mode 100644 tests/specs/lockfile/adding_redirect/1.ts create mode 100644 tests/specs/lockfile/adding_redirect/2.ts create mode 100644 tests/specs/lockfile/adding_redirect/__test__.jsonc create mode 100644 tests/specs/lockfile/adding_redirect/deno.json create mode 100644 tests/specs/lockfile/adding_redirect/lock01.out create mode 100644 tests/specs/lockfile/adding_redirect/lock02.out create mode 100644 tests/specs/lockfile/auto_discover_lockfile/__test__.jsonc create mode 100644 tests/specs/lockfile/auto_discover_lockfile/deno.json create mode 100644 tests/specs/lockfile/auto_discover_lockfile/deno.lock create mode 100644 tests/specs/lockfile/auto_discover_lockfile/main.out create mode 100644 tests/specs/lockfile/auto_discover_lockfile/main.ts create mode 100644 tests/specs/lockfile/checksum_at_redirect/__test__.jsonc create mode 100644 tests/specs/lockfile/checksum_at_redirect/deno.json create mode 100644 tests/specs/lockfile/checksum_at_redirect/deno.lock create mode 100644 tests/specs/lockfile/checksum_at_redirect/run.out create mode 100644 tests/specs/lockfile/config_file_lock_boolean/__test__.jsonc create mode 100644 tests/specs/lockfile/config_file_lock_boolean/deno.lock create mode 100644 tests/specs/lockfile/config_file_lock_boolean/false.json create mode 100644 tests/specs/lockfile/config_file_lock_boolean/false.main.out create mode 100644 tests/specs/lockfile/config_file_lock_boolean/main.ts create mode 100644 tests/specs/lockfile/config_file_lock_boolean/true.json create mode 100644 tests/specs/lockfile/config_file_lock_boolean/true.main.out create mode 100644 tests/specs/lockfile/config_file_lock_path/019_media_types.ts.out create mode 100644 tests/specs/lockfile/config_file_lock_path/__test__.jsonc create mode 100644 tests/specs/lockfile/config_file_lock_path/config_file_lock_path.json create mode 100644 tests/specs/lockfile/config_file_lock_path/config_file_lock_path.out create mode 100644 tests/specs/lockfile/config_file_lock_path/lock_check_err2.json create mode 100644 tests/specs/lockfile/config_file_lock_path/lock_check_err2.out create mode 100644 tests/specs/lockfile/config_file_lock_path/lock_check_ok2.json create mode 100644 tests/specs/lockfile/config_file_lock_path/run/lock_check_ok2.json create mode 100644 tests/specs/lockfile/lock_check_err/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_check_err/lock_check_err.json create mode 100644 tests/specs/lockfile/lock_check_err/lock_check_err.out create mode 100644 tests/specs/lockfile/lock_check_err2/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_check_err2/lock_check_err2.json create mode 100644 tests/specs/lockfile/lock_check_err2/lock_check_err2.out create mode 100644 tests/specs/lockfile/lock_dynamic_imports/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json create mode 100644 tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.out create mode 100644 tests/specs/lockfile/lock_v2_check_err/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json create mode 100644 tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.out create mode 100644 tests/specs/lockfile/lock_v2_check_err2/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json create mode 100644 tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.out create mode 100644 tests/specs/lockfile/lock_v2_dynamic_imports/__test__.jsonc create mode 100644 tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json create mode 100644 tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.out delete mode 100644 tests/specs/lockfile/no_lock/fail_initial.out create mode 100644 tests/specs/npm/lock_file_integrity_failure/__test__.jsonc create mode 100644 tests/specs/npm/lock_file_integrity_failure/lock.json create mode 100644 tests/specs/npm/lock_file_integrity_failure/main.js create mode 100644 tests/specs/npm/lock_file_integrity_failure/main.out delete mode 100644 tests/testdata/bundle/lockfile/check_error.json delete mode 100644 tests/testdata/bundle/lockfile/check_error.out delete mode 100644 tests/testdata/npm/lock_file/lock.json delete mode 100644 tests/testdata/npm/lock_file/main.js delete mode 100644 tests/testdata/npm/lock_file/main.out delete mode 100644 tests/testdata/run/auto_discover_lockfile/deno.json delete mode 100644 tests/testdata/run/auto_discover_lockfile/deno.lock delete mode 100644 tests/testdata/run/auto_discover_lockfile/main.out delete mode 100644 tests/testdata/run/auto_discover_lockfile/main.ts delete mode 100644 tests/testdata/run/config_file_lock_boolean/deno.lock delete mode 100644 tests/testdata/run/config_file_lock_boolean/false.json delete mode 100644 tests/testdata/run/config_file_lock_boolean/false.main.out delete mode 100644 tests/testdata/run/config_file_lock_boolean/main.ts delete mode 100644 tests/testdata/run/config_file_lock_boolean/true.json delete mode 100644 tests/testdata/run/config_file_lock_boolean/true.main.out delete mode 100644 tests/testdata/run/config_file_lock_path.json delete mode 100644 tests/testdata/run/config_file_lock_path.out delete mode 100644 tests/testdata/run/lock_check_err.json delete mode 100644 tests/testdata/run/lock_check_err.out delete mode 100644 tests/testdata/run/lock_check_err2.out delete mode 100644 tests/testdata/run/lock_dynamic_imports.json delete mode 100644 tests/testdata/run/lock_dynamic_imports.out delete mode 100644 tests/testdata/run/lock_v2_check_err.json delete mode 100644 tests/testdata/run/lock_v2_check_err.out delete mode 100644 tests/testdata/run/lock_v2_check_err2.json delete mode 100644 tests/testdata/run/lock_v2_check_err2.out delete mode 100644 tests/testdata/run/lock_v2_dynamic_imports.json delete mode 100644 tests/testdata/run/lock_v2_dynamic_imports.out (limited to 'tests') diff --git a/tests/integration/bundle_tests.rs b/tests/integration/bundle_tests.rs index 0738a0cfe..20f883293 100644 --- a/tests/integration/bundle_tests.rs +++ b/tests/integration/bundle_tests.rs @@ -416,13 +416,6 @@ fn bundle_json_module_escape_sub() { ); } -itest!(lockfile_check_error { - args: "bundle --lock=bundle/lockfile/check_error.json http://127.0.0.1:4545/subdir/mod1.ts", - output: "bundle/lockfile/check_error.out", - exit_code: 10, - http_server: true, -}); - itest!(bundle { args: "bundle subdir/mod1.ts", output: "bundle/bundle.test.out", diff --git a/tests/integration/jsr_tests.rs b/tests/integration/jsr_tests.rs index 83d696093..7da0cc5b5 100644 --- a/tests/integration/jsr_tests.rs +++ b/tests/integration/jsr_tests.rs @@ -141,7 +141,12 @@ console.log(version);"#, .assert_matches_text("0.1.1\n"); let lockfile_path = temp_dir.path().join("deno.lock"); - let mut lockfile = Lockfile::new(lockfile_path.to_path_buf(), false).unwrap(); + let mut lockfile = Lockfile::with_lockfile_content( + lockfile_path.to_path_buf(), + &lockfile_path.read_to_string(), + false, + ) + .unwrap(); *lockfile .content .packages @@ -214,7 +219,7 @@ fn reload_info_not_found_cache_but_exists_remote() { .args("run --cached-only main.ts") .run(); output.assert_exit_code(1); - output.assert_matches_text("error: Failed to resolve version constraint. Try running again without --cached-only + output.assert_matches_text("error: JSR package manifest for '@denotest/add' failed to load. Could not resolve version constraint using only cached data. Try running again without --cached-only at file:///[WILDCARD]main.ts:1:21 "); @@ -251,7 +256,12 @@ console.log(version);"#, .assert_matches_text("0.1.1\n"); let lockfile_path = temp_dir.path().join("deno.lock"); - let mut lockfile = Lockfile::new(lockfile_path.to_path_buf(), false).unwrap(); + let mut lockfile = Lockfile::with_lockfile_content( + lockfile_path.to_path_buf(), + &lockfile_path.read_to_string(), + false, + ) + .unwrap(); let pkg_name = "@denotest/no-module-graph@0.1.1"; let original_integrity = get_lockfile_pkg_integrity(&lockfile, pkg_name); set_lockfile_pkg_integrity(&mut lockfile, pkg_name, "bad_integrity"); @@ -259,18 +269,24 @@ console.log(version);"#, let actual_integrity = test_context.get_jsr_package_integrity("@denotest/no-module-graph/0.1.1"); - let integrity_check_failed_msg = format!("error: Integrity check failed for http://127.0.0.1:4250/@denotest/no-module-graph/0.1.1_meta.json + let integrity_check_failed_msg = format!("[WILDCARD]Integrity check failed for package. The source code is invalid, as it does not match the expected hash in the lock file. -Actual: {} -Expected: bad_integrity - at file:///[WILDCARD]/main.ts:1:21 + Package: @denotest/no-module-graph@0.1.1 + Actual: {} + Expected: bad_integrity + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. ", actual_integrity); test_context .new_command() .args("run --quiet main.ts") .run() .assert_matches_text(&integrity_check_failed_msg) - .assert_exit_code(1); + .assert_exit_code(10); // now try with a vendor folder temp_dir @@ -284,7 +300,7 @@ Expected: bad_integrity .args("run --quiet main.ts") .run() .assert_matches_text(&integrity_check_failed_msg) - .assert_exit_code(1); + .assert_exit_code(10); // now update to the correct integrity set_lockfile_pkg_integrity(&mut lockfile, pkg_name, &original_integrity); @@ -318,7 +334,7 @@ Expected: bad_integrity .args("run --quiet main.ts") .run() .assert_matches_text(&integrity_check_failed_msg) - .assert_exit_code(1); + .assert_exit_code(10); } #[test] @@ -335,39 +351,39 @@ console.log(add);"#, // test it properly checks the checksum on download test_context .new_command() - .args("run main.ts") + .args("run main.ts") .run() .assert_matches_text( "Download http://127.0.0.1:4250/@denotest/bad-manifest-checksum/meta.json Download http://127.0.0.1:4250/@denotest/bad-manifest-checksum/1.0.0_meta.json Download http://127.0.0.1:4250/@denotest/bad-manifest-checksum/1.0.0/mod.ts -error: Integrity check failed. +error: Integrity check failed in package. The package may have been tampered with. -Actual: 9a30ac96b5d5c1b67eca69e1e2cf0798817d9578c8d7d904a81a67b983b35cba -Expected: bad-checksum - at file:///[WILDCARD]main.ts:1:21 + Specifier: http://127.0.0.1:4250/@denotest/bad-manifest-checksum/1.0.0/mod.ts + Actual: 9a30ac96b5d5c1b67eca69e1e2cf0798817d9578c8d7d904a81a67b983b35cba + Expected: bad-checksum + +If you modified your global cache, run again with the --reload flag to restore its state. If you want to modify dependencies locally run again with the --vendor flag or specify `\"vendor\": true` in a deno.json then modify the contents of the vendor/ folder. ", ) - .assert_exit_code(1); + .assert_exit_code(10); // test it properly checks the checksum when loading from the cache test_context .new_command() - .args("run main.ts") + .args("run main.ts") .run() .assert_matches_text( - // ideally the two error messages would be the same... this one comes from - // deno_cache and the one above comes from deno_graph. The thing is, in deno_cache - // (source of this error) it makes sense to include the url in the error message - // because it's not always used in the context of deno_graph - "error: Integrity check failed for http://127.0.0.1:4250/@denotest/bad-manifest-checksum/1.0.0/mod.ts - -Actual: 9a30ac96b5d5c1b67eca69e1e2cf0798817d9578c8d7d904a81a67b983b35cba -Expected: bad-checksum - at file:///[WILDCARD]main.ts:1:21 + "error: Integrity check failed in package. The package may have been tampered with. + + Specifier: http://127.0.0.1:4250/@denotest/bad-manifest-checksum/1.0.0/mod.ts + Actual: 9a30ac96b5d5c1b67eca69e1e2cf0798817d9578c8d7d904a81a67b983b35cba + Expected: bad-checksum + +If you modified your global cache, run again with the --reload flag to restore its state. If you want to modify dependencies locally run again with the --vendor flag or specify `\"vendor\": true` in a deno.json then modify the contents of the vendor/ folder. ", ) - .assert_exit_code(1); + .assert_exit_code(10); } fn get_lockfile_pkg_integrity(lockfile: &Lockfile, pkg_name: &str) -> String { diff --git a/tests/integration/npm_tests.rs b/tests/integration/npm_tests.rs index 63547cfce..923d151be 100644 --- a/tests/integration/npm_tests.rs +++ b/tests/integration/npm_tests.rs @@ -214,19 +214,11 @@ itest!(cached_only { }); itest!(import_map { - args: "run --allow-read --allow-env --import-map npm/import_map/import_map.json npm/import_map/main.js", - output: "npm/import_map/main.out", - envs: env_vars_for_npm_tests(), - http_server: true, - }); - -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(), - http_server: true, - exit_code: 10, - }); + args: "run --allow-read --allow-env --import-map npm/import_map/import_map.json npm/import_map/main.js", + output: "npm/import_map/main.out", + envs: env_vars_for_npm_tests(), + http_server: true, +}); itest!(sub_paths { args: "run -A --quiet npm/sub_paths/main.jsx", @@ -1518,7 +1510,7 @@ 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". +Use the --lock-write flag to regenerate the lockfile at "[WILDCARD]deno.lock". "#) .assert_exit_code(10); } diff --git a/tests/integration/run_tests.rs b/tests/integration/run_tests.rs index f3fc18fee..91370a87c 100644 --- a/tests/integration/run_tests.rs +++ b/tests/integration/run_tests.rs @@ -821,40 +821,6 @@ itest!(lock_check_ok2 { http_server: true, }); -itest!(lock_dynamic_imports { - args: "run --lock=run/lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/run/013_dynamic_import.ts", - output: "run/lock_dynamic_imports.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_check_err { - args: "run --lock=run/lock_check_err.json http://127.0.0.1:4545/run/003_relative_import.ts", - output: "run/lock_check_err.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_check_err2 { - args: "run --lock=run/lock_check_err2.json run/019_media_types.ts", - output: "run/lock_check_err2.out", - exit_code: 10, - http_server: true, -}); - -itest!(config_file_lock_path { - args: "run --config=run/config_file_lock_path.json run/019_media_types.ts", - output: "run/config_file_lock_path.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_flag_overrides_config_file_lock_path { - args: "run --lock=run/lock_check_ok2.json --config=run/config_file_lock_path.json run/019_media_types.ts", - output: "run/019_media_types.ts.out", - http_server: true, -}); - itest!(lock_v2_check_ok { args: "run --quiet --lock=run/lock_v2_check_ok.json http://127.0.0.1:4545/run/003_relative_import.ts", @@ -868,33 +834,6 @@ itest!(lock_v2_check_ok2 { http_server: true, }); -itest!(lock_v2_dynamic_imports { - args: "run --lock=run/lock_v2_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/run/013_dynamic_import.ts", - output: "run/lock_v2_dynamic_imports.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_v2_check_err { - args: "run --lock=run/lock_v2_check_err.json http://127.0.0.1:4545/run/003_relative_import.ts", - output: "run/lock_v2_check_err.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_v2_check_err2 { - args: "run --lock=run/lock_v2_check_err2.json run/019_media_types.ts", - output: "run/lock_v2_check_err2.out", - exit_code: 10, - http_server: true, -}); - -itest!(lock_only_http_and_https { - args: "run --lock=run/lock_only_http_and_https/deno.lock run/lock_only_http_and_https/main.ts", - output: "run/lock_only_http_and_https/main.out", - http_server: true, -}); - #[test] fn lock_no_declaration_files() { let context = TestContextBuilder::new() @@ -4562,13 +4501,6 @@ async fn websocket_server_idletimeout() { assert_eq!(child.wait().unwrap().code(), Some(123)); } -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, -}); - itest!(no_lock_flag { args: "run --no-lock run/no_lock_flag/main.ts", output: "run/no_lock_flag/main.out", @@ -4576,20 +4508,6 @@ itest!(no_lock_flag { exit_code: 0, }); -itest!(config_file_lock_false { - args: "run --config=run/config_file_lock_boolean/false.json run/config_file_lock_boolean/main.ts", - output: "run/config_file_lock_boolean/false.main.out", - http_server: true, - exit_code: 0, -}); - -itest!(config_file_lock_true { - args: "run --config=run/config_file_lock_boolean/true.json run/config_file_lock_boolean/main.ts", - output: "run/config_file_lock_boolean/true.main.out", - http_server: true, - exit_code: 10, -}); - itest!(permission_args { args: "run run/001_hello.js --allow-net", output: "run/permission_args.out", @@ -4812,21 +4730,17 @@ console.log(returnsHi());"#, .join("mod1.ts"); mod1_file.write("export function returnsHi() { return 'bye bye bye'; }"); - // won't match the lockfile now - deno_run_cmd - .run() - .assert_matches_text(r#"error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/mod1.ts - Lock file: [WILDCARD]deno.lock -"#) - .assert_exit_code(10); + // this is fine with a lockfile because users are supposed to be able + // to modify the vendor folder + deno_run_cmd.run().assert_matches_text("bye bye bye\n"); // try updating by deleting the lockfile let lockfile = temp_dir.path().join("deno.lock"); lockfile.remove_file(); cache_command.run(); - // now it should run + // should still run and the lockfile should be recreated + // (though with the checksum from the vendor folder) deno_run_cmd.run().assert_matches_text("bye bye bye\n"); assert!(lockfile.exists()); diff --git a/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/add.ts b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/add.ts new file mode 100644 index 000000000..de02f6902 --- /dev/null +++ b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/add.ts @@ -0,0 +1 @@ +export * from "jsr:@denotest/add@1"; diff --git a/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/subtract.ts b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/subtract.ts new file mode 100644 index 000000000..215c42310 --- /dev/null +++ b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0/subtract.ts @@ -0,0 +1 @@ +export * from "jsr:@denotest/subtract@1"; diff --git a/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0_meta.json b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0_meta.json new file mode 100644 index 000000000..9af658497 --- /dev/null +++ b/tests/registry/jsr/@denotest/different-deps-per-export/1.0.0_meta.json @@ -0,0 +1,6 @@ +{ + "exports": { + "./add": "./add.ts", + "./subtract": "./subtract.ts" + } +} diff --git a/tests/registry/jsr/@denotest/different-deps-per-export/meta.json b/tests/registry/jsr/@denotest/different-deps-per-export/meta.json new file mode 100644 index 000000000..02601e4d0 --- /dev/null +++ b/tests/registry/jsr/@denotest/different-deps-per-export/meta.json @@ -0,0 +1,5 @@ +{ + "versions": { + "1.0.0": {} + } +} diff --git a/tests/registry/jsr/@denotest/subtract/1.0.0/mod.ts b/tests/registry/jsr/@denotest/subtract/1.0.0/mod.ts new file mode 100644 index 000000000..b5bd2dfcf --- /dev/null +++ b/tests/registry/jsr/@denotest/subtract/1.0.0/mod.ts @@ -0,0 +1,3 @@ +export function subtract(a: number, b: number): number { + return a - b; +} diff --git a/tests/registry/jsr/@denotest/subtract/1.0.0_meta.json b/tests/registry/jsr/@denotest/subtract/1.0.0_meta.json new file mode 100644 index 000000000..6eebe2198 --- /dev/null +++ b/tests/registry/jsr/@denotest/subtract/1.0.0_meta.json @@ -0,0 +1,8 @@ +{ + "exports": { + ".": "./mod.ts" + }, + "moduleGraph1": { + "/mod.ts": {} + } +} diff --git a/tests/registry/jsr/@denotest/subtract/meta.json b/tests/registry/jsr/@denotest/subtract/meta.json new file mode 100644 index 000000000..02601e4d0 --- /dev/null +++ b/tests/registry/jsr/@denotest/subtract/meta.json @@ -0,0 +1,5 @@ +{ + "versions": { + "1.0.0": {} + } +} diff --git a/tests/registry/npm/@denotest/add/1.0.0/index.d.ts b/tests/registry/npm/@denotest/add/1.0.0/index.d.ts new file mode 100644 index 000000000..9b197eb1e --- /dev/null +++ b/tests/registry/npm/@denotest/add/1.0.0/index.d.ts @@ -0,0 +1 @@ +export function add(a: number, b: number): number; diff --git a/tests/registry/npm/@denotest/add/1.0.0/index.js b/tests/registry/npm/@denotest/add/1.0.0/index.js new file mode 100644 index 000000000..8a40cd7fd --- /dev/null +++ b/tests/registry/npm/@denotest/add/1.0.0/index.js @@ -0,0 +1 @@ +module.exports.add = (a, b) => a + b; \ No newline at end of file diff --git a/tests/registry/npm/@denotest/add/1.0.0/package.json b/tests/registry/npm/@denotest/add/1.0.0/package.json new file mode 100644 index 000000000..01d662baa --- /dev/null +++ b/tests/registry/npm/@denotest/add/1.0.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "@denotest/add", + "version": "1.0.0" +} diff --git a/tests/registry/npm/@denotest/subtract/1.0.0/index.d.ts b/tests/registry/npm/@denotest/subtract/1.0.0/index.d.ts new file mode 100644 index 000000000..c26a4aec5 --- /dev/null +++ b/tests/registry/npm/@denotest/subtract/1.0.0/index.d.ts @@ -0,0 +1 @@ +export function subtract(a: number, b: number): number; diff --git a/tests/registry/npm/@denotest/subtract/1.0.0/index.js b/tests/registry/npm/@denotest/subtract/1.0.0/index.js new file mode 100644 index 000000000..0114210a4 --- /dev/null +++ b/tests/registry/npm/@denotest/subtract/1.0.0/index.js @@ -0,0 +1 @@ +module.exports.subtract = (a, b) => a - b; \ No newline at end of file diff --git a/tests/registry/npm/@denotest/subtract/1.0.0/package.json b/tests/registry/npm/@denotest/subtract/1.0.0/package.json new file mode 100644 index 000000000..5ed43efa9 --- /dev/null +++ b/tests/registry/npm/@denotest/subtract/1.0.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "@denotest/subtract", + "version": "1.0.0" +} diff --git a/tests/specs/bundle/lockfile/__test__.jsonc b/tests/specs/bundle/lockfile/__test__.jsonc new file mode 100644 index 000000000..3fe64a28b --- /dev/null +++ b/tests/specs/bundle/lockfile/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "bundle --lock=check_error.json http://127.0.0.1:4545/subdir/mod1.ts", + "output": "check_error.out", + "exitCode": 10 +} diff --git a/tests/specs/bundle/lockfile/check_error.json b/tests/specs/bundle/lockfile/check_error.json new file mode 100644 index 000000000..a218d7000 --- /dev/null +++ b/tests/specs/bundle/lockfile/check_error.json @@ -0,0 +1,5 @@ +{ + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/tests/specs/bundle/lockfile/check_error.out b/tests/specs/bundle/lockfile/check_error.out new file mode 100644 index 000000000..2b8bdfc96 --- /dev/null +++ b/tests/specs/bundle/lockfile/check_error.out @@ -0,0 +1,12 @@ +[WILDCARD] +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts + Actual: 8b3b670d25d238dfa72df119140406b96766a00fee635f3606429fe065b18fd1 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/install/future_install_node_modules/corrupted.out b/tests/specs/install/future_install_node_modules/corrupted.out index 89578cbe2..9943c1ce9 100644 --- a/tests/specs/install/future_install_node_modules/corrupted.out +++ b/tests/specs/install/future_install_node_modules/corrupted.out @@ -1,3 +1,3 @@ [WILDCARD] error: Integrity check failed for package: "npm:@denotest/esm-basic@1.0.0".[WILDCARD] -Use "--lock-write" flag to regenerate the lockfile at [WILDCARD] \ No newline at end of file +Use the --lock-write flag to regenerate the lockfile at [WILDCARD] \ No newline at end of file diff --git a/tests/specs/jsr/version_not_found/main.out b/tests/specs/jsr/version_not_found/main.out index 6a32b5d81..081917d71 100644 --- a/tests/specs/jsr/version_not_found/main.out +++ b/tests/specs/jsr/version_not_found/main.out @@ -1,5 +1,4 @@ Download http://127.0.0.1:4250/@denotest/deps/meta.json Download http://127.0.0.1:4250/@denotest/deps/meta.json -error: Could not find constraint in the list of versions: @denotest/deps@0.1.4 - Specifier: jsr:@denotest/deps@0.1.4/mod.ts +error: Could not find version of '@denotest/deps' that matches specified version constraint '0.1.4' at file:///[WILDCARD]/version_not_found/main.ts:1:19 diff --git a/tests/specs/lockfile/adding_jsr_dep/__test__.jsonc b/tests/specs/lockfile/adding_jsr_dep/__test__.jsonc new file mode 100644 index 000000000..905aaf49c --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [{ + "args": "run add.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock01.out" + }, { + "args": "run subtract.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock02.out" + }] +} diff --git a/tests/specs/lockfile/adding_jsr_dep/add.ts b/tests/specs/lockfile/adding_jsr_dep/add.ts new file mode 100644 index 000000000..c0fe70808 --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/add.ts @@ -0,0 +1 @@ +import "add"; diff --git a/tests/specs/lockfile/adding_jsr_dep/deno.json b/tests/specs/lockfile/adding_jsr_dep/deno.json new file mode 100644 index 000000000..c37f65adc --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/deno.json @@ -0,0 +1,9 @@ +{ + "tasks": { + "cat": "cat" + }, + "imports": { + "add": "jsr:@denotest/add@1", + "subtract": "jsr:@denotest/subtract@1" + } +} diff --git a/tests/specs/lockfile/adding_jsr_dep/lock01.out b/tests/specs/lockfile/adding_jsr_dep/lock01.out new file mode 100644 index 000000000..0ac007526 --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/lock01.out @@ -0,0 +1,20 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denotest/add@1": "jsr:@denotest/add@1.0.0" + }, + "jsr": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]" + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@denotest/add@1", + "jsr:@denotest/subtract@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_jsr_dep/lock02.out b/tests/specs/lockfile/adding_jsr_dep/lock02.out new file mode 100644 index 000000000..4293c7dfe --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/lock02.out @@ -0,0 +1,24 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denotest/add@1": "jsr:@denotest/add@1.0.0", + "jsr:@denotest/subtract@1": "jsr:@denotest/subtract@1.0.0" + }, + "jsr": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]" + }, + "@denotest/subtract@1.0.0": { + "integrity": "[WILDLINE]" + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@denotest/add@1", + "jsr:@denotest/subtract@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_jsr_dep/subtract.ts b/tests/specs/lockfile/adding_jsr_dep/subtract.ts new file mode 100644 index 000000000..b07f2cdfd --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_dep/subtract.ts @@ -0,0 +1 @@ +import "subtract"; diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/__test__.jsonc b/tests/specs/lockfile/adding_jsr_export_new_dep/__test__.jsonc new file mode 100644 index 000000000..905aaf49c --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [{ + "args": "run add.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock01.out" + }, { + "args": "run subtract.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock02.out" + }] +} diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/add.ts b/tests/specs/lockfile/adding_jsr_export_new_dep/add.ts new file mode 100644 index 000000000..06492d2ec --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/add.ts @@ -0,0 +1 @@ +import "different-deps-per-export/add"; diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/deno.json b/tests/specs/lockfile/adding_jsr_export_new_dep/deno.json new file mode 100644 index 000000000..b26a08521 --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/deno.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "cat": "cat" + }, + "imports": { + "different-deps-per-export": "jsr:@denotest/different-deps-per-export@1" + } +} diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/lock01.out b/tests/specs/lockfile/adding_jsr_export_new_dep/lock01.out new file mode 100644 index 000000000..e78ea355a --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/lock01.out @@ -0,0 +1,26 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denotest/add@1": "jsr:@denotest/add@1.0.0", + "jsr:@denotest/different-deps-per-export@1": "jsr:@denotest/different-deps-per-export@1.0.0" + }, + "jsr": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]" + }, + "@denotest/different-deps-per-export@1.0.0": { + "integrity": "[WILDLINE]", + "dependencies": [ + "jsr:@denotest/add@1" + ] + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@denotest/different-deps-per-export@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/lock02.out b/tests/specs/lockfile/adding_jsr_export_new_dep/lock02.out new file mode 100644 index 000000000..0f4a388c6 --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/lock02.out @@ -0,0 +1,31 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denotest/add@1": "jsr:@denotest/add@1.0.0", + "jsr:@denotest/different-deps-per-export@1": "jsr:@denotest/different-deps-per-export@1.0.0", + "jsr:@denotest/subtract@1": "jsr:@denotest/subtract@1.0.0" + }, + "jsr": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]" + }, + "@denotest/different-deps-per-export@1.0.0": { + "integrity": "[WILDLINE]", + "dependencies": [ + "jsr:@denotest/add@1", + "jsr:@denotest/subtract@1" + ] + }, + "@denotest/subtract@1.0.0": { + "integrity": "[WILDLINE]" + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "jsr:@denotest/different-deps-per-export@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_jsr_export_new_dep/subtract.ts b/tests/specs/lockfile/adding_jsr_export_new_dep/subtract.ts new file mode 100644 index 000000000..1576e29e2 --- /dev/null +++ b/tests/specs/lockfile/adding_jsr_export_new_dep/subtract.ts @@ -0,0 +1 @@ +import "different-deps-per-export/subtract"; diff --git a/tests/specs/lockfile/adding_npm_dep/__test__.jsonc b/tests/specs/lockfile/adding_npm_dep/__test__.jsonc new file mode 100644 index 000000000..905aaf49c --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [{ + "args": "run add.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock01.out" + }, { + "args": "run subtract.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock02.out" + }] +} diff --git a/tests/specs/lockfile/adding_npm_dep/add.ts b/tests/specs/lockfile/adding_npm_dep/add.ts new file mode 100644 index 000000000..c0fe70808 --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/add.ts @@ -0,0 +1 @@ +import "add"; diff --git a/tests/specs/lockfile/adding_npm_dep/deno.json b/tests/specs/lockfile/adding_npm_dep/deno.json new file mode 100644 index 000000000..b3bfef815 --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/deno.json @@ -0,0 +1,9 @@ +{ + "tasks": { + "cat": "cat" + }, + "imports": { + "add": "npm:@denotest/add@1", + "subtract": "npm:@denotest/subtract@1" + } +} diff --git a/tests/specs/lockfile/adding_npm_dep/lock01.out b/tests/specs/lockfile/adding_npm_dep/lock01.out new file mode 100644 index 000000000..5d5567dc0 --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/lock01.out @@ -0,0 +1,21 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@denotest/add@1": "npm:@denotest/add@1.0.0" + }, + "npm": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]", + "dependencies": {} + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "npm:@denotest/add@1", + "npm:@denotest/subtract@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_npm_dep/lock02.out b/tests/specs/lockfile/adding_npm_dep/lock02.out new file mode 100644 index 000000000..6042b1cb9 --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/lock02.out @@ -0,0 +1,26 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@denotest/add@1": "npm:@denotest/add@1.0.0", + "npm:@denotest/subtract@1": "npm:@denotest/subtract@1.0.0" + }, + "npm": { + "@denotest/add@1.0.0": { + "integrity": "[WILDLINE]", + "dependencies": {} + }, + "@denotest/subtract@1.0.0": { + "integrity": "[WILDLINE]", + "dependencies": {} + } + } + }, + "remote": {}, + "workspace": { + "dependencies": [ + "npm:@denotest/add@1", + "npm:@denotest/subtract@1" + ] + } +} diff --git a/tests/specs/lockfile/adding_npm_dep/subtract.ts b/tests/specs/lockfile/adding_npm_dep/subtract.ts new file mode 100644 index 000000000..b07f2cdfd --- /dev/null +++ b/tests/specs/lockfile/adding_npm_dep/subtract.ts @@ -0,0 +1 @@ +import "subtract"; diff --git a/tests/specs/lockfile/adding_redirect/1.ts b/tests/specs/lockfile/adding_redirect/1.ts new file mode 100644 index 000000000..7556f2266 --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/1.ts @@ -0,0 +1 @@ +import "http://localhost:4545/welcome.ts"; diff --git a/tests/specs/lockfile/adding_redirect/2.ts b/tests/specs/lockfile/adding_redirect/2.ts new file mode 100644 index 000000000..525b6bc7e --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/2.ts @@ -0,0 +1 @@ +import "http://localhost:4546/welcome.ts"; diff --git a/tests/specs/lockfile/adding_redirect/__test__.jsonc b/tests/specs/lockfile/adding_redirect/__test__.jsonc new file mode 100644 index 000000000..d53beedbd --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [{ + "args": "run 1.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock01.out" + }, { + "args": "run 2.ts", + "output": "[WILDCARD]" + }, { + "args": "task --quiet cat deno.lock", + "output": "lock02.out" + }] +} diff --git a/tests/specs/lockfile/adding_redirect/deno.json b/tests/specs/lockfile/adding_redirect/deno.json new file mode 100644 index 000000000..75cddd826 --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "cat": "cat" + } +} diff --git a/tests/specs/lockfile/adding_redirect/lock01.out b/tests/specs/lockfile/adding_redirect/lock01.out new file mode 100644 index 000000000..f00cefa6a --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/lock01.out @@ -0,0 +1,6 @@ +{ + "version": "3", + "remote": { + "http://localhost:4545/welcome.ts": "7353d5fcbc36c45d26bcbca478cf973092523b07c45999f41319820092b4de31" + } +} diff --git a/tests/specs/lockfile/adding_redirect/lock02.out b/tests/specs/lockfile/adding_redirect/lock02.out new file mode 100644 index 000000000..70c38c966 --- /dev/null +++ b/tests/specs/lockfile/adding_redirect/lock02.out @@ -0,0 +1,9 @@ +{ + "version": "3", + "redirects": { + "http://localhost:4546/welcome.ts": "http://localhost:4545/welcome.ts" + }, + "remote": { + "http://localhost:4545/welcome.ts": "7353d5fcbc36c45d26bcbca478cf973092523b07c45999f41319820092b4de31" + } +} diff --git a/tests/specs/lockfile/auto_discover_lockfile/__test__.jsonc b/tests/specs/lockfile/auto_discover_lockfile/__test__.jsonc new file mode 100644 index 000000000..50213381a --- /dev/null +++ b/tests/specs/lockfile/auto_discover_lockfile/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run main.ts", + "output": "main.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/auto_discover_lockfile/deno.json b/tests/specs/lockfile/auto_discover_lockfile/deno.json new file mode 100644 index 000000000..90faa728a --- /dev/null +++ b/tests/specs/lockfile/auto_discover_lockfile/deno.json @@ -0,0 +1,3 @@ +{ + "tasks": {} +} diff --git a/tests/specs/lockfile/auto_discover_lockfile/deno.lock b/tests/specs/lockfile/auto_discover_lockfile/deno.lock new file mode 100644 index 000000000..059f66789 --- /dev/null +++ b/tests/specs/lockfile/auto_discover_lockfile/deno.lock @@ -0,0 +1,7 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f", + "http://localhost:4545/subdir/print_hello.ts": "foobar" + } +} diff --git a/tests/specs/lockfile/auto_discover_lockfile/main.out b/tests/specs/lockfile/auto_discover_lockfile/main.out new file mode 100644 index 000000000..aa24320d1 --- /dev/null +++ b/tests/specs/lockfile/auto_discover_lockfile/main.out @@ -0,0 +1,13 @@ +Download http://localhost:4545/subdir/mod2.ts +Download http://localhost:4545/subdir/print_hello.ts +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/print_hello.ts + Actual: fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c + Expected: foobar + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/auto_discover_lockfile/main.ts b/tests/specs/lockfile/auto_discover_lockfile/main.ts new file mode 100644 index 000000000..baa52775d --- /dev/null +++ b/tests/specs/lockfile/auto_discover_lockfile/main.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mod2.ts"; diff --git a/tests/specs/lockfile/checksum_at_redirect/__test__.jsonc b/tests/specs/lockfile/checksum_at_redirect/__test__.jsonc new file mode 100644 index 000000000..66d9850da --- /dev/null +++ b/tests/specs/lockfile/checksum_at_redirect/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --config=deno.json http://localhost:4546/run/001_hello.js", + "output": "run.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/checksum_at_redirect/deno.json b/tests/specs/lockfile/checksum_at_redirect/deno.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/tests/specs/lockfile/checksum_at_redirect/deno.json @@ -0,0 +1,2 @@ +{ +} diff --git a/tests/specs/lockfile/checksum_at_redirect/deno.lock b/tests/specs/lockfile/checksum_at_redirect/deno.lock new file mode 100644 index 000000000..12e84cd01 --- /dev/null +++ b/tests/specs/lockfile/checksum_at_redirect/deno.lock @@ -0,0 +1,6 @@ +{ + "version": "3", + "remote": { + "http://localhost:4546/run/001_hello.js": "c479db5ea26965387423ca438bb977d0b4788d5901efcef52f69871e4c1048c5" + } +} diff --git a/tests/specs/lockfile/checksum_at_redirect/run.out b/tests/specs/lockfile/checksum_at_redirect/run.out new file mode 100644 index 000000000..75a34777f --- /dev/null +++ b/tests/specs/lockfile/checksum_at_redirect/run.out @@ -0,0 +1,12 @@ +Download http://localhost:4546/run/001_hello.js +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4546/run/001_hello.js + Actual: Redirect to http://localhost:4545/run/001_hello.js + Expected: c479db5ea26965387423ca438bb977d0b4788d5901efcef52f69871e4c1048c5 + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/config_file_lock_boolean/__test__.jsonc b/tests/specs/lockfile/config_file_lock_boolean/__test__.jsonc new file mode 100644 index 000000000..65679a1c8 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tests": { + "true": { + "args": "run --config=true.json main.ts", + "output": "true.main.out", + "exitCode": 10 + }, + "false": { + "args": "run --config=false.json main.ts", + "output": "false.main.out" + } + } +} diff --git a/tests/specs/lockfile/config_file_lock_boolean/deno.lock b/tests/specs/lockfile/config_file_lock_boolean/deno.lock new file mode 100644 index 000000000..059f66789 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/deno.lock @@ -0,0 +1,7 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f", + "http://localhost:4545/subdir/print_hello.ts": "foobar" + } +} diff --git a/tests/specs/lockfile/config_file_lock_boolean/false.json b/tests/specs/lockfile/config_file_lock_boolean/false.json new file mode 100644 index 000000000..358b7d299 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/false.json @@ -0,0 +1,3 @@ +{ + "lock": false +} diff --git a/tests/specs/lockfile/config_file_lock_boolean/false.main.out b/tests/specs/lockfile/config_file_lock_boolean/false.main.out new file mode 100644 index 000000000..0d8f0a237 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/false.main.out @@ -0,0 +1,2 @@ +Download http://localhost:4545/subdir/mod2.ts +Download http://localhost:4545/subdir/print_hello.ts diff --git a/tests/specs/lockfile/config_file_lock_boolean/main.ts b/tests/specs/lockfile/config_file_lock_boolean/main.ts new file mode 100644 index 000000000..baa52775d --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/main.ts @@ -0,0 +1 @@ +import "http://localhost:4545/subdir/mod2.ts"; diff --git a/tests/specs/lockfile/config_file_lock_boolean/true.json b/tests/specs/lockfile/config_file_lock_boolean/true.json new file mode 100644 index 000000000..090481af9 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/true.json @@ -0,0 +1,3 @@ +{ + "lock": true +} diff --git a/tests/specs/lockfile/config_file_lock_boolean/true.main.out b/tests/specs/lockfile/config_file_lock_boolean/true.main.out new file mode 100644 index 000000000..11dfc0740 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_boolean/true.main.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/print_hello.ts + Actual: fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c + Expected: foobar + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/config_file_lock_path/019_media_types.ts.out b/tests/specs/lockfile/config_file_lock_path/019_media_types.ts.out new file mode 100644 index 000000000..b3e94678c --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/019_media_types.ts.out @@ -0,0 +1 @@ +[WILDCARD]success true true true true true true true true diff --git a/tests/specs/lockfile/config_file_lock_path/__test__.jsonc b/tests/specs/lockfile/config_file_lock_path/__test__.jsonc new file mode 100644 index 000000000..defb113b3 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "tests": { + "error_bad_checksum": { + "args": "run --config=config_file_lock_path.json http://localhost:4545/run/019_media_types.ts", + "output": "config_file_lock_path.out", + "exitCode": 10 + }, + "lock_flag_override": { + "args": "run --lock=run/lock_check_ok2.json --config=config_file_lock_path.json http://localhost:4545/run/019_media_types.ts", + "output": "019_media_types.ts.out" + } + } +} diff --git a/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.json b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.json new file mode 100644 index 000000000..2c393f76e --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.json @@ -0,0 +1,3 @@ +{ + "lock": "./lock_check_err2.json" +} diff --git a/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.out b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.out new file mode 100644 index 000000000..1383d945d --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js + Actual: 3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/config_file_lock_path/lock_check_err2.json b/tests/specs/lockfile/config_file_lock_path/lock_check_err2.json new file mode 100644 index 000000000..a59cbc9e3 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/lock_check_err2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out b/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out new file mode 100644 index 000000000..1383d945d --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/lock_check_err2.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js + Actual: 3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/config_file_lock_path/lock_check_ok2.json b/tests/specs/lockfile/config_file_lock_path/lock_check_ok2.json new file mode 100644 index 000000000..14d8b7117 --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/lock_check_ok2.json @@ -0,0 +1,13 @@ +{ + "version": "3", + "remote": { + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" + } +} diff --git a/tests/specs/lockfile/config_file_lock_path/run/lock_check_ok2.json b/tests/specs/lockfile/config_file_lock_path/run/lock_check_ok2.json new file mode 100644 index 000000000..e1bf67c8f --- /dev/null +++ b/tests/specs/lockfile/config_file_lock_path/run/lock_check_ok2.json @@ -0,0 +1,14 @@ +{ + "version": "3", + "remote": { + "http://localhost:4545/run/019_media_types.ts": "6b099d422b8a83e19d6672ad28c1c42dd3523eaadd8029f185bf4d10c1dc6e92", + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" + } +} diff --git a/tests/specs/lockfile/lock_check_err/__test__.jsonc b/tests/specs/lockfile/lock_check_err/__test__.jsonc new file mode 100644 index 000000000..7b4777fad --- /dev/null +++ b/tests/specs/lockfile/lock_check_err/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_check_err.json http://127.0.0.1:4545/run/003_relative_import.ts", + "output": "lock_check_err.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_check_err/lock_check_err.json b/tests/specs/lockfile/lock_check_err/lock_check_err.json new file mode 100644 index 000000000..fc6c2d45c --- /dev/null +++ b/tests/specs/lockfile/lock_check_err/lock_check_err.json @@ -0,0 +1,4 @@ +{ + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/run/003_relative_import.ts": "bad" +} diff --git a/tests/specs/lockfile/lock_check_err/lock_check_err.out b/tests/specs/lockfile/lock_check_err/lock_check_err.out new file mode 100644 index 000000000..25d22490d --- /dev/null +++ b/tests/specs/lockfile/lock_check_err/lock_check_err.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://127.0.0.1:4545/run/003_relative_import.ts + Actual: a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/lock_check_err2/__test__.jsonc b/tests/specs/lockfile/lock_check_err2/__test__.jsonc new file mode 100644 index 000000000..adcf816c4 --- /dev/null +++ b/tests/specs/lockfile/lock_check_err2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_check_err2.json http://localhost:4545/run/019_media_types.ts", + "output": "lock_check_err2.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_check_err2/lock_check_err2.json b/tests/specs/lockfile/lock_check_err2/lock_check_err2.json new file mode 100644 index 000000000..a59cbc9e3 --- /dev/null +++ b/tests/specs/lockfile/lock_check_err2/lock_check_err2.json @@ -0,0 +1,10 @@ +{ + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" +} diff --git a/tests/specs/lockfile/lock_check_err2/lock_check_err2.out b/tests/specs/lockfile/lock_check_err2/lock_check_err2.out new file mode 100644 index 000000000..1383d945d --- /dev/null +++ b/tests/specs/lockfile/lock_check_err2/lock_check_err2.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js + Actual: 3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/lock_dynamic_imports/__test__.jsonc b/tests/specs/lockfile/lock_dynamic_imports/__test__.jsonc new file mode 100644 index 000000000..54b993295 --- /dev/null +++ b/tests/specs/lockfile/lock_dynamic_imports/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/run/013_dynamic_import.ts", + "output": "lock_dynamic_imports.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json new file mode 100644 index 000000000..0269b9409 --- /dev/null +++ b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json @@ -0,0 +1,6 @@ +{ + "http://127.0.0.1:4545/run/013_dynamic_import.ts": "3f83e653329dc1f963761a986997d710b9763f667fc243eef89b3a5decacda30", + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" +} diff --git a/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.out b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.out new file mode 100644 index 000000000..2b8bdfc96 --- /dev/null +++ b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.out @@ -0,0 +1,12 @@ +[WILDCARD] +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts + Actual: 8b3b670d25d238dfa72df119140406b96766a00fee635f3606429fe065b18fd1 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/lock_v2_check_err/__test__.jsonc b/tests/specs/lockfile/lock_v2_check_err/__test__.jsonc new file mode 100644 index 000000000..b58fddeec --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_v2_check_err.json http://127.0.0.1:4545/run/003_relative_import.ts", + "output": "lock_v2_check_err.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json new file mode 100644 index 000000000..6bd6491c6 --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json @@ -0,0 +1,7 @@ +{ + "version": "2", + "remote": { + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/run/003_relative_import.ts": "bad" + } +} diff --git a/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.out b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.out new file mode 100644 index 000000000..25d22490d --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://127.0.0.1:4545/run/003_relative_import.ts + Actual: a1572e8fd2c2712b33f04aed2561505b5feb2c8696f1f2cded3de7127931b97e + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/lock_v2_check_err2/__test__.jsonc b/tests/specs/lockfile/lock_v2_check_err2/__test__.jsonc new file mode 100644 index 000000000..bb02b41e2 --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err2/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_v2_check_err2.json http://localhost:4545/run/019_media_types.ts", + "output": "lock_v2_check_err2.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json new file mode 100644 index 000000000..30fbcdf4b --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json @@ -0,0 +1,13 @@ +{ + "version": "2", + "remote": { + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" + } +} diff --git a/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.out b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.out new file mode 100644 index 000000000..1383d945d --- /dev/null +++ b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.out @@ -0,0 +1,11 @@ +[WILDCARD]Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js + Actual: 3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/lock_v2_dynamic_imports/__test__.jsonc b/tests/specs/lockfile/lock_v2_dynamic_imports/__test__.jsonc new file mode 100644 index 000000000..8d8913431 --- /dev/null +++ b/tests/specs/lockfile/lock_v2_dynamic_imports/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --lock=lock_v2_dynamic_imports.json --allow-read --allow-net http://127.0.0.1:4545/run/013_dynamic_import.ts", + "output": "lock_v2_dynamic_imports.out", + "exitCode": 10 +} diff --git a/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json new file mode 100644 index 000000000..eadbee272 --- /dev/null +++ b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json @@ -0,0 +1,9 @@ +{ + "version": "2", + "remote": { + "http://127.0.0.1:4545/run/013_dynamic_import.ts": "3f83e653329dc1f963761a986997d710b9763f667fc243eef89b3a5decacda30", + "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", + "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", + "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" + } +} diff --git a/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.out b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.out new file mode 100644 index 000000000..2b8bdfc96 --- /dev/null +++ b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.out @@ -0,0 +1,12 @@ +[WILDCARD] +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts + Actual: 8b3b670d25d238dfa72df119140406b96766a00fee635f3606429fe065b18fd1 + Expected: bad + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/no_lock/__test__.jsonc b/tests/specs/lockfile/no_lock/__test__.jsonc index 60bbd17e0..75821ac64 100644 --- a/tests/specs/lockfile/no_lock/__test__.jsonc +++ b/tests/specs/lockfile/no_lock/__test__.jsonc @@ -1,31 +1,40 @@ { - "steps": [{ - "args": "info main.ts", - "output": "fail_initial.out", - "exitCode": 10 - }, { - "args": "info --no-lock main.ts", - "output": "info.nolock.out" - }, { - "args": "bench", - "output": "fail.out", - "exitCode": 10 - }, { - "args": "bench --no-lock", - "output": "bench.nolock.out" - }, { - "args": "doc main.ts", - "exitCode": 10, - "output": "fail.out" - }, { - "args": "doc --no-lock main.ts", - "output": "doc.nolock.out" - }, { - "args": "test", - "exitCode": 10, - "output": "fail.out" - }, { - "args": "test --no-lock", - "output": "test.nolock.out" - }] + "tests": { + "info": { + "args": "info main.ts", + "output": "fail.out", + "exitCode": 10 + }, + "info_no_lock": { + "args": "info --no-lock main.ts", + "output": "info.nolock.out" + }, + "bench": { + "args": "bench", + "output": "fail.out", + "exitCode": 10 + }, + "bench_no_lock": { + "args": "bench --no-lock", + "output": "bench.nolock.out" + }, + "doc": { + "args": "doc main.ts", + "exitCode": 10, + "output": "fail.out" + }, + "doc_no_lock": { + "args": "doc --no-lock main.ts", + "output": "doc.nolock.out" + }, + "test": { + "args": "test", + "exitCode": 10, + "output": "fail.out" + }, + "test_no_lock": { + "args": "test --no-lock", + "output": "test.nolock.out" + } + } } diff --git a/tests/specs/lockfile/no_lock/bench.nolock.out b/tests/specs/lockfile/no_lock/bench.nolock.out index 351efc970..83e4de242 100644 --- a/tests/specs/lockfile/no_lock/bench.nolock.out +++ b/tests/specs/lockfile/no_lock/bench.nolock.out @@ -1,3 +1,4 @@ +Download http://localhost:4545/lockfile/basic/mod.ts Check file:///[WILDCARD]/main.bench.ts cpu: [WILDCARD] runtime: [WILDCARD] diff --git a/tests/specs/lockfile/no_lock/doc.nolock.out b/tests/specs/lockfile/no_lock/doc.nolock.out index e69de29bb..e2d66c027 100644 --- a/tests/specs/lockfile/no_lock/doc.nolock.out +++ b/tests/specs/lockfile/no_lock/doc.nolock.out @@ -0,0 +1 @@ +Download http://localhost:4545/lockfile/basic/mod.ts diff --git a/tests/specs/lockfile/no_lock/fail.out b/tests/specs/lockfile/no_lock/fail.out index 4c2b04423..0d67cd478 100644 --- a/tests/specs/lockfile/no_lock/fail.out +++ b/tests/specs/lockfile/no_lock/fail.out @@ -1,3 +1,12 @@ -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: [WILDCARD]mod.ts - Lock file: [WILDCARD]deno.lock +Download http://localhost:4545/lockfile/basic/mod.ts +error: Integrity check failed for remote specifier. The source code is invalid, as it does not match the expected hash in the lock file. + + Specifier: http://localhost:4545/lockfile/basic/mod.ts + Actual: [WILDLINE] + Expected: invalid + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile or --reload to reload the source code from the server. diff --git a/tests/specs/lockfile/no_lock/fail_initial.out b/tests/specs/lockfile/no_lock/fail_initial.out deleted file mode 100644 index 6a808c0a5..000000000 --- a/tests/specs/lockfile/no_lock/fail_initial.out +++ /dev/null @@ -1,4 +0,0 @@ -Download http://localhost:4545/lockfile/basic/mod.ts -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: [WILDCARD]mod.ts - Lock file: [WILDCARD]deno.lock diff --git a/tests/specs/lockfile/no_lock/info.nolock.out b/tests/specs/lockfile/no_lock/info.nolock.out index b03661193..313377780 100644 --- a/tests/specs/lockfile/no_lock/info.nolock.out +++ b/tests/specs/lockfile/no_lock/info.nolock.out @@ -1,3 +1,4 @@ +Download http://localhost:4545/lockfile/basic/mod.ts local: [WILDLINE]main.ts type: TypeScript dependencies: 1 unique diff --git a/tests/specs/lockfile/no_lock/test.nolock.out b/tests/specs/lockfile/no_lock/test.nolock.out index b5039c2d6..1332dfa8f 100644 --- a/tests/specs/lockfile/no_lock/test.nolock.out +++ b/tests/specs/lockfile/no_lock/test.nolock.out @@ -1,3 +1,4 @@ +Download http://localhost:4545/lockfile/basic/mod.ts Check file:///[WILDCARD]/main.test.ts running 1 test from [WILDCARD]/main.test.ts [WILDCARD] diff --git a/tests/specs/npm/lock_file_integrity_failure/__test__.jsonc b/tests/specs/npm/lock_file_integrity_failure/__test__.jsonc new file mode 100644 index 000000000..d2f1b06a2 --- /dev/null +++ b/tests/specs/npm/lock_file_integrity_failure/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "run --allow-read --allow-env --lock lock.json main.js", + "output": "main.out", + "exitCode": 10 +} diff --git a/tests/specs/npm/lock_file_integrity_failure/lock.json b/tests/specs/npm/lock_file_integrity_failure/lock.json new file mode 100644 index 000000000..57253314e --- /dev/null +++ b/tests/specs/npm/lock_file_integrity_failure/lock.json @@ -0,0 +1,164 @@ +{ + "version": "2", + "remote": {}, + "npm": { + "specifiers": { "fs-extra@10.1.0": "fs-extra@10.1.0", "vue": "vue@3.2.38" }, + "packages": { + "@babel/parser@7.19.0": { + "integrity": "sha512-foobar!", + "dependencies": {} + }, + "@vue/compiler-core@3.2.38": { + "integrity": "sha512-/FsvnSu7Z+lkd/8KXMa4yYNUiqQrI22135gfsQYVGuh5tqEgOB0XqrUdb/KnCLa5+TmQLPwvyUnKMyCpu+SX3Q==", + "dependencies": { + "@babel/parser": "@babel/parser@7.19.0", + "@vue/shared": "@vue/shared@3.2.38", + "estree-walker": "estree-walker@2.0.2", + "source-map": "source-map@0.6.1" + } + }, + "@vue/compiler-dom@3.2.38": { + "integrity": "sha512-zqX4FgUbw56kzHlgYuEEJR8mefFiiyR3u96498+zWPsLeh1WKvgIReoNE+U7gG8bCUdvsrJ0JRmev0Ky6n2O0g==", + "dependencies": { + "@vue/compiler-core": "@vue/compiler-core@3.2.38", + "@vue/shared": "@vue/shared@3.2.38" + } + }, + "@vue/compiler-sfc@3.2.38": { + "integrity": "sha512-KZjrW32KloMYtTcHAFuw3CqsyWc5X6seb8KbkANSWt3Cz9p2qA8c1GJpSkksFP9ABb6an0FLCFl46ZFXx3kKpg==", + "dependencies": { + "@babel/parser": "@babel/parser@7.19.0", + "@vue/compiler-core": "@vue/compiler-core@3.2.38", + "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", + "@vue/compiler-ssr": "@vue/compiler-ssr@3.2.38", + "@vue/reactivity-transform": "@vue/reactivity-transform@3.2.38", + "@vue/shared": "@vue/shared@3.2.38", + "estree-walker": "estree-walker@2.0.2", + "magic-string": "magic-string@0.25.9", + "postcss": "postcss@8.4.16", + "source-map": "source-map@0.6.1" + } + }, + "@vue/compiler-ssr@3.2.38": { + "integrity": "sha512-bm9jOeyv1H3UskNm4S6IfueKjUNFmi2kRweFIGnqaGkkRePjwEcfCVqyS3roe7HvF4ugsEkhf4+kIvDhip6XzQ==", + "dependencies": { + "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", + "@vue/shared": "@vue/shared@3.2.38" + } + }, + "@vue/reactivity-transform@3.2.38": { + "integrity": "sha512-3SD3Jmi1yXrDwiNJqQ6fs1x61WsDLqVk4NyKVz78mkaIRh6d3IqtRnptgRfXn+Fzf+m6B1KxBYWq1APj6h4qeA==", + "dependencies": { + "@babel/parser": "@babel/parser@7.19.0", + "@vue/compiler-core": "@vue/compiler-core@3.2.38", + "@vue/shared": "@vue/shared@3.2.38", + "estree-walker": "estree-walker@2.0.2", + "magic-string": "magic-string@0.25.9" + } + }, + "@vue/reactivity@3.2.38": { + "integrity": "sha512-6L4myYcH9HG2M25co7/BSo0skKFHpAN8PhkNPM4xRVkyGl1K5M3Jx4rp5bsYhvYze2K4+l+pioN4e6ZwFLUVtw==", + "dependencies": { "@vue/shared": "@vue/shared@3.2.38" } + }, + "@vue/runtime-core@3.2.38": { + "integrity": "sha512-kk0qiSiXUU/IKxZw31824rxmFzrLr3TL6ZcbrxWTKivadoKupdlzbQM4SlGo4MU6Zzrqv4fzyUasTU1jDoEnzg==", + "dependencies": { + "@vue/reactivity": "@vue/reactivity@3.2.38", + "@vue/shared": "@vue/shared@3.2.38" + } + }, + "@vue/runtime-dom@3.2.38": { + "integrity": "sha512-4PKAb/ck2TjxdMSzMsnHViOrrwpudk4/A56uZjhzvusoEU9xqa5dygksbzYepdZeB5NqtRw5fRhWIiQlRVK45A==", + "dependencies": { + "@vue/runtime-core": "@vue/runtime-core@3.2.38", + "@vue/shared": "@vue/shared@3.2.38", + "csstype": "csstype@2.6.20" + } + }, + "@vue/server-renderer@3.2.38": { + "integrity": "sha512-pg+JanpbOZ5kEfOZzO2bt02YHd+ELhYP8zPeLU1H0e7lg079NtuuSB8fjLdn58c4Ou8UQ6C1/P+528nXnLPAhA==", + "dependencies": { + "@vue/compiler-ssr": "@vue/compiler-ssr@3.2.38", + "@vue/shared": "@vue/shared@3.2.38" + } + }, + "@vue/shared@3.2.38": { + "integrity": "sha512-dTyhTIRmGXBjxJE+skC8tTWCGLCVc4wQgRRLt8+O9p5ewBAjoBwtCAkLPrtToSr1xltoe3st21Pv953aOZ7alg==", + "dependencies": {} + }, + "csstype@2.6.20": { + "integrity": "sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==", + "dependencies": {} + }, + "estree-walker@2.0.2": { + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dependencies": {} + }, + "fs-extra@10.1.0": { + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "graceful-fs@4.2.10", + "jsonfile": "jsonfile@6.1.0", + "universalify": "universalify@2.0.0" + } + }, + "graceful-fs@4.2.10": { + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dependencies": {} + }, + "jsonfile@6.1.0": { + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "graceful-fs": "graceful-fs@4.2.10", + "universalify": "universalify@2.0.0" + } + }, + "magic-string@0.25.9": { + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dependencies": { "sourcemap-codec": "sourcemap-codec@1.4.8" } + }, + "nanoid@3.3.4": { + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "dependencies": {} + }, + "picocolors@1.0.0": { + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dependencies": {} + }, + "postcss@8.4.16": { + "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", + "dependencies": { + "nanoid": "nanoid@3.3.4", + "picocolors": "picocolors@1.0.0", + "source-map-js": "source-map-js@1.0.2" + } + }, + "source-map-js@1.0.2": { + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dependencies": {} + }, + "source-map@0.6.1": { + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dependencies": {} + }, + "sourcemap-codec@1.4.8": { + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dependencies": {} + }, + "universalify@2.0.0": { + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dependencies": {} + }, + "vue@3.2.38": { + "integrity": "sha512-hHrScEFSmDAWL0cwO4B6WO7D3sALZPbfuThDsGBebthrNlDxdJZpGR3WB87VbjpPh96mep1+KzukYEhpHDFa8Q==", + "dependencies": { + "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", + "@vue/compiler-sfc": "@vue/compiler-sfc@3.2.38", + "@vue/runtime-dom": "@vue/runtime-dom@3.2.38", + "@vue/server-renderer": "@vue/server-renderer@3.2.38", + "@vue/shared": "@vue/shared@3.2.38" + } + } + } + } +} diff --git a/tests/specs/npm/lock_file_integrity_failure/main.js b/tests/specs/npm/lock_file_integrity_failure/main.js new file mode 100644 index 000000000..a7b5960ca --- /dev/null +++ b/tests/specs/npm/lock_file_integrity_failure/main.js @@ -0,0 +1,5 @@ +import fsx from "npm:fs-extra@10.1.0"; +import { createApp } from "npm:vue"; + +console.log(fsx.access); +console.log(createApp); diff --git a/tests/specs/npm/lock_file_integrity_failure/main.out b/tests/specs/npm/lock_file_integrity_failure/main.out new file mode 100644 index 000000000..741edd9d2 --- /dev/null +++ b/tests/specs/npm/lock_file_integrity_failure/main.out @@ -0,0 +1,12 @@ +Download [WILDCARD] +error: Integrity check failed for package: "npm:@babel/parser@7.19.0". Unable to verify that the package +is the same as when the lockfile was generated. + +Actual: sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== +Expected: sha512-foobar! + +This could be caused by: + * the lock file may be corrupt + * the source itself may be corrupt + +Use the --lock-write flag to regenerate the lockfile at "[WILDCARD]lock.json". diff --git a/tests/testdata/bundle/lockfile/check_error.json b/tests/testdata/bundle/lockfile/check_error.json deleted file mode 100644 index a218d7000..000000000 --- a/tests/testdata/bundle/lockfile/check_error.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" -} diff --git a/tests/testdata/bundle/lockfile/check_error.out b/tests/testdata/bundle/lockfile/check_error.out deleted file mode 100644 index 9299bc27e..000000000 --- a/tests/testdata/bundle/lockfile/check_error.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Lock file: bundle/lockfile/check_error.json diff --git a/tests/testdata/fmt/invalid_data.out b/tests/testdata/fmt/invalid_data.out index dee00fcc5..d0869e9ee 100644 --- a/tests/testdata/fmt/invalid_data.out +++ b/tests/testdata/fmt/invalid_data.out @@ -1,4 +1,4 @@ -error: [WILDCARD] is not a valid UTF-8 file +Error checking: [WILDCARD] Line 1, column 1: Unexpected token -Caused by: - invalid data +[WILDCARD] +error: Found 1 not formatted file in 1 file diff --git a/tests/testdata/npm/lock_file/lock.json b/tests/testdata/npm/lock_file/lock.json deleted file mode 100644 index 57253314e..000000000 --- a/tests/testdata/npm/lock_file/lock.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "version": "2", - "remote": {}, - "npm": { - "specifiers": { "fs-extra@10.1.0": "fs-extra@10.1.0", "vue": "vue@3.2.38" }, - "packages": { - "@babel/parser@7.19.0": { - "integrity": "sha512-foobar!", - "dependencies": {} - }, - "@vue/compiler-core@3.2.38": { - "integrity": "sha512-/FsvnSu7Z+lkd/8KXMa4yYNUiqQrI22135gfsQYVGuh5tqEgOB0XqrUdb/KnCLa5+TmQLPwvyUnKMyCpu+SX3Q==", - "dependencies": { - "@babel/parser": "@babel/parser@7.19.0", - "@vue/shared": "@vue/shared@3.2.38", - "estree-walker": "estree-walker@2.0.2", - "source-map": "source-map@0.6.1" - } - }, - "@vue/compiler-dom@3.2.38": { - "integrity": "sha512-zqX4FgUbw56kzHlgYuEEJR8mefFiiyR3u96498+zWPsLeh1WKvgIReoNE+U7gG8bCUdvsrJ0JRmev0Ky6n2O0g==", - "dependencies": { - "@vue/compiler-core": "@vue/compiler-core@3.2.38", - "@vue/shared": "@vue/shared@3.2.38" - } - }, - "@vue/compiler-sfc@3.2.38": { - "integrity": "sha512-KZjrW32KloMYtTcHAFuw3CqsyWc5X6seb8KbkANSWt3Cz9p2qA8c1GJpSkksFP9ABb6an0FLCFl46ZFXx3kKpg==", - "dependencies": { - "@babel/parser": "@babel/parser@7.19.0", - "@vue/compiler-core": "@vue/compiler-core@3.2.38", - "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", - "@vue/compiler-ssr": "@vue/compiler-ssr@3.2.38", - "@vue/reactivity-transform": "@vue/reactivity-transform@3.2.38", - "@vue/shared": "@vue/shared@3.2.38", - "estree-walker": "estree-walker@2.0.2", - "magic-string": "magic-string@0.25.9", - "postcss": "postcss@8.4.16", - "source-map": "source-map@0.6.1" - } - }, - "@vue/compiler-ssr@3.2.38": { - "integrity": "sha512-bm9jOeyv1H3UskNm4S6IfueKjUNFmi2kRweFIGnqaGkkRePjwEcfCVqyS3roe7HvF4ugsEkhf4+kIvDhip6XzQ==", - "dependencies": { - "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", - "@vue/shared": "@vue/shared@3.2.38" - } - }, - "@vue/reactivity-transform@3.2.38": { - "integrity": "sha512-3SD3Jmi1yXrDwiNJqQ6fs1x61WsDLqVk4NyKVz78mkaIRh6d3IqtRnptgRfXn+Fzf+m6B1KxBYWq1APj6h4qeA==", - "dependencies": { - "@babel/parser": "@babel/parser@7.19.0", - "@vue/compiler-core": "@vue/compiler-core@3.2.38", - "@vue/shared": "@vue/shared@3.2.38", - "estree-walker": "estree-walker@2.0.2", - "magic-string": "magic-string@0.25.9" - } - }, - "@vue/reactivity@3.2.38": { - "integrity": "sha512-6L4myYcH9HG2M25co7/BSo0skKFHpAN8PhkNPM4xRVkyGl1K5M3Jx4rp5bsYhvYze2K4+l+pioN4e6ZwFLUVtw==", - "dependencies": { "@vue/shared": "@vue/shared@3.2.38" } - }, - "@vue/runtime-core@3.2.38": { - "integrity": "sha512-kk0qiSiXUU/IKxZw31824rxmFzrLr3TL6ZcbrxWTKivadoKupdlzbQM4SlGo4MU6Zzrqv4fzyUasTU1jDoEnzg==", - "dependencies": { - "@vue/reactivity": "@vue/reactivity@3.2.38", - "@vue/shared": "@vue/shared@3.2.38" - } - }, - "@vue/runtime-dom@3.2.38": { - "integrity": "sha512-4PKAb/ck2TjxdMSzMsnHViOrrwpudk4/A56uZjhzvusoEU9xqa5dygksbzYepdZeB5NqtRw5fRhWIiQlRVK45A==", - "dependencies": { - "@vue/runtime-core": "@vue/runtime-core@3.2.38", - "@vue/shared": "@vue/shared@3.2.38", - "csstype": "csstype@2.6.20" - } - }, - "@vue/server-renderer@3.2.38": { - "integrity": "sha512-pg+JanpbOZ5kEfOZzO2bt02YHd+ELhYP8zPeLU1H0e7lg079NtuuSB8fjLdn58c4Ou8UQ6C1/P+528nXnLPAhA==", - "dependencies": { - "@vue/compiler-ssr": "@vue/compiler-ssr@3.2.38", - "@vue/shared": "@vue/shared@3.2.38" - } - }, - "@vue/shared@3.2.38": { - "integrity": "sha512-dTyhTIRmGXBjxJE+skC8tTWCGLCVc4wQgRRLt8+O9p5ewBAjoBwtCAkLPrtToSr1xltoe3st21Pv953aOZ7alg==", - "dependencies": {} - }, - "csstype@2.6.20": { - "integrity": "sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==", - "dependencies": {} - }, - "estree-walker@2.0.2": { - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dependencies": {} - }, - "fs-extra@10.1.0": { - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "graceful-fs@4.2.10", - "jsonfile": "jsonfile@6.1.0", - "universalify": "universalify@2.0.0" - } - }, - "graceful-fs@4.2.10": { - "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", - "dependencies": {} - }, - "jsonfile@6.1.0": { - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dependencies": { - "graceful-fs": "graceful-fs@4.2.10", - "universalify": "universalify@2.0.0" - } - }, - "magic-string@0.25.9": { - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dependencies": { "sourcemap-codec": "sourcemap-codec@1.4.8" } - }, - "nanoid@3.3.4": { - "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", - "dependencies": {} - }, - "picocolors@1.0.0": { - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dependencies": {} - }, - "postcss@8.4.16": { - "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", - "dependencies": { - "nanoid": "nanoid@3.3.4", - "picocolors": "picocolors@1.0.0", - "source-map-js": "source-map-js@1.0.2" - } - }, - "source-map-js@1.0.2": { - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", - "dependencies": {} - }, - "source-map@0.6.1": { - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dependencies": {} - }, - "sourcemap-codec@1.4.8": { - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dependencies": {} - }, - "universalify@2.0.0": { - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dependencies": {} - }, - "vue@3.2.38": { - "integrity": "sha512-hHrScEFSmDAWL0cwO4B6WO7D3sALZPbfuThDsGBebthrNlDxdJZpGR3WB87VbjpPh96mep1+KzukYEhpHDFa8Q==", - "dependencies": { - "@vue/compiler-dom": "@vue/compiler-dom@3.2.38", - "@vue/compiler-sfc": "@vue/compiler-sfc@3.2.38", - "@vue/runtime-dom": "@vue/runtime-dom@3.2.38", - "@vue/server-renderer": "@vue/server-renderer@3.2.38", - "@vue/shared": "@vue/shared@3.2.38" - } - } - } - } -} diff --git a/tests/testdata/npm/lock_file/main.js b/tests/testdata/npm/lock_file/main.js deleted file mode 100644 index a7b5960ca..000000000 --- a/tests/testdata/npm/lock_file/main.js +++ /dev/null @@ -1,5 +0,0 @@ -import fsx from "npm:fs-extra@10.1.0"; -import { createApp } from "npm:vue"; - -console.log(fsx.access); -console.log(createApp); diff --git a/tests/testdata/npm/lock_file/main.out b/tests/testdata/npm/lock_file/main.out deleted file mode 100644 index dead1a623..000000000 --- a/tests/testdata/npm/lock_file/main.out +++ /dev/null @@ -1,12 +0,0 @@ -Download [WILDCARD] -error: Integrity check failed for package: "npm:@babel/parser@7.19.0". Unable to verify that the package -is the same as when the lockfile was generated. - -Actual: sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== -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]lock.json". diff --git a/tests/testdata/run/auto_discover_lockfile/deno.json b/tests/testdata/run/auto_discover_lockfile/deno.json deleted file mode 100644 index 90faa728a..000000000 --- a/tests/testdata/run/auto_discover_lockfile/deno.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tasks": {} -} diff --git a/tests/testdata/run/auto_discover_lockfile/deno.lock b/tests/testdata/run/auto_discover_lockfile/deno.lock deleted file mode 100644 index 059f66789..000000000 --- a/tests/testdata/run/auto_discover_lockfile/deno.lock +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f", - "http://localhost:4545/subdir/print_hello.ts": "foobar" - } -} diff --git a/tests/testdata/run/auto_discover_lockfile/main.out b/tests/testdata/run/auto_discover_lockfile/main.out deleted file mode 100644 index 28f4724e9..000000000 --- a/tests/testdata/run/auto_discover_lockfile/main.out +++ /dev/null @@ -1,5 +0,0 @@ -Download http://localhost:4545/subdir/mod2.ts -Download http://localhost:4545/subdir/print_hello.ts -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/print_hello.ts - Lock file: [WILDCARD]auto_discover_lockfile[WILDCARD]deno.lock diff --git a/tests/testdata/run/auto_discover_lockfile/main.ts b/tests/testdata/run/auto_discover_lockfile/main.ts deleted file mode 100644 index baa52775d..000000000 --- a/tests/testdata/run/auto_discover_lockfile/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/subdir/mod2.ts"; diff --git a/tests/testdata/run/config_file_lock_boolean/deno.lock b/tests/testdata/run/config_file_lock_boolean/deno.lock deleted file mode 100644 index 059f66789..000000000 --- a/tests/testdata/run/config_file_lock_boolean/deno.lock +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/subdir/mod2.ts": "cae1d3e9f3c38cd415ff52dff854be8f3d17d35f8d7b3d285e813fb0f6393a2f", - "http://localhost:4545/subdir/print_hello.ts": "foobar" - } -} diff --git a/tests/testdata/run/config_file_lock_boolean/false.json b/tests/testdata/run/config_file_lock_boolean/false.json deleted file mode 100644 index 358b7d299..000000000 --- a/tests/testdata/run/config_file_lock_boolean/false.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lock": false -} diff --git a/tests/testdata/run/config_file_lock_boolean/false.main.out b/tests/testdata/run/config_file_lock_boolean/false.main.out deleted file mode 100644 index 0d8f0a237..000000000 --- a/tests/testdata/run/config_file_lock_boolean/false.main.out +++ /dev/null @@ -1,2 +0,0 @@ -Download http://localhost:4545/subdir/mod2.ts -Download http://localhost:4545/subdir/print_hello.ts diff --git a/tests/testdata/run/config_file_lock_boolean/main.ts b/tests/testdata/run/config_file_lock_boolean/main.ts deleted file mode 100644 index baa52775d..000000000 --- a/tests/testdata/run/config_file_lock_boolean/main.ts +++ /dev/null @@ -1 +0,0 @@ -import "http://localhost:4545/subdir/mod2.ts"; diff --git a/tests/testdata/run/config_file_lock_boolean/true.json b/tests/testdata/run/config_file_lock_boolean/true.json deleted file mode 100644 index 090481af9..000000000 --- a/tests/testdata/run/config_file_lock_boolean/true.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lock": true -} diff --git a/tests/testdata/run/config_file_lock_boolean/true.main.out b/tests/testdata/run/config_file_lock_boolean/true.main.out deleted file mode 100644 index 313c0eb0c..000000000 --- a/tests/testdata/run/config_file_lock_boolean/true.main.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/print_hello.ts - Lock file: [WILDCARD]deno.lock diff --git a/tests/testdata/run/config_file_lock_path.json b/tests/testdata/run/config_file_lock_path.json deleted file mode 100644 index 2c393f76e..000000000 --- a/tests/testdata/run/config_file_lock_path.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lock": "./lock_check_err2.json" -} diff --git a/tests/testdata/run/config_file_lock_path.out b/tests/testdata/run/config_file_lock_path.out deleted file mode 100644 index 97d35337f..000000000 --- a/tests/testdata/run/config_file_lock_path.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js - Lock file: [WILDCARD]lock_check_err2.json diff --git a/tests/testdata/run/lock_check_err.json b/tests/testdata/run/lock_check_err.json deleted file mode 100644 index fc6c2d45c..000000000 --- a/tests/testdata/run/lock_check_err.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/run/003_relative_import.ts": "bad" -} diff --git a/tests/testdata/run/lock_check_err.out b/tests/testdata/run/lock_check_err.out deleted file mode 100644 index e4cc7b81a..000000000 --- a/tests/testdata/run/lock_check_err.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/run/003_relative_import.ts - Lock file: run/lock_check_err.json diff --git a/tests/testdata/run/lock_check_err2.json b/tests/testdata/run/lock_check_err2.json index a59cbc9e3..14d8b7117 100644 --- a/tests/testdata/run/lock_check_err2.json +++ b/tests/testdata/run/lock_check_err2.json @@ -1,10 +1,13 @@ { - "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", - "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" + "version": "3", + "remote": { + "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", + "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" + } } diff --git a/tests/testdata/run/lock_check_err2.out b/tests/testdata/run/lock_check_err2.out deleted file mode 100644 index 065c7434b..000000000 --- a/tests/testdata/run/lock_check_err2.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js - Lock file: run/lock_check_err2.json diff --git a/tests/testdata/run/lock_dynamic_imports.json b/tests/testdata/run/lock_dynamic_imports.json deleted file mode 100644 index 0269b9409..000000000 --- a/tests/testdata/run/lock_dynamic_imports.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "http://127.0.0.1:4545/run/013_dynamic_import.ts": "3f83e653329dc1f963761a986997d710b9763f667fc243eef89b3a5decacda30", - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" -} diff --git a/tests/testdata/run/lock_dynamic_imports.out b/tests/testdata/run/lock_dynamic_imports.out deleted file mode 100644 index acc65c8e6..000000000 --- a/tests/testdata/run/lock_dynamic_imports.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Lock file: run/lock_dynamic_imports.json diff --git a/tests/testdata/run/lock_v2_check_err.json b/tests/testdata/run/lock_v2_check_err.json deleted file mode 100644 index 6bd6491c6..000000000 --- a/tests/testdata/run/lock_v2_check_err.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2", - "remote": { - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/run/003_relative_import.ts": "bad" - } -} diff --git a/tests/testdata/run/lock_v2_check_err.out b/tests/testdata/run/lock_v2_check_err.out deleted file mode 100644 index 28ad01cf4..000000000 --- a/tests/testdata/run/lock_v2_check_err.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/run/003_relative_import.ts - Lock file: run/lock_v2_check_err.json diff --git a/tests/testdata/run/lock_v2_check_err2.json b/tests/testdata/run/lock_v2_check_err2.json deleted file mode 100644 index 30fbcdf4b..000000000 --- a/tests/testdata/run/lock_v2_check_err2.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "2", - "remote": { - "http://localhost:4545/subdir/mt_application_ecmascript.j2.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_javascript.j4.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_application_x_typescript.t4.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_ecmascript.j3.js": "bad", - "http://localhost:4545/subdir/mt_text_javascript.j1.js": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_text_typescript.t1.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_mp2t.t3.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18", - "http://localhost:4545/subdir/mt_video_vdn.t2.ts": "3a3e002e2f92dc8f045bd4a7c66b4791453ad0417b038dd2b2d9d0f277c44f18" - } -} diff --git a/tests/testdata/run/lock_v2_check_err2.out b/tests/testdata/run/lock_v2_check_err2.out deleted file mode 100644 index 3d82cba27..000000000 --- a/tests/testdata/run/lock_v2_check_err2.out +++ /dev/null @@ -1,3 +0,0 @@ -[WILDCARD]The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://localhost:4545/subdir/mt_text_ecmascript.j3.js - Lock file: run/lock_v2_check_err2.json diff --git a/tests/testdata/run/lock_v2_dynamic_imports.json b/tests/testdata/run/lock_v2_dynamic_imports.json deleted file mode 100644 index eadbee272..000000000 --- a/tests/testdata/run/lock_v2_dynamic_imports.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "2", - "remote": { - "http://127.0.0.1:4545/run/013_dynamic_import.ts": "3f83e653329dc1f963761a986997d710b9763f667fc243eef89b3a5decacda30", - "http://127.0.0.1:4545/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f", - "http://127.0.0.1:4545/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c", - "http://127.0.0.1:4545/subdir/subdir2/mod2.ts": "bad" - } -} diff --git a/tests/testdata/run/lock_v2_dynamic_imports.out b/tests/testdata/run/lock_v2_dynamic_imports.out deleted file mode 100644 index 36c2c9b5c..000000000 --- a/tests/testdata/run/lock_v2_dynamic_imports.out +++ /dev/null @@ -1,4 +0,0 @@ -[WILDCARD] -error: The source code is invalid, as it does not match the expected hash in the lock file. - Specifier: http://127.0.0.1:4545/subdir/subdir2/mod2.ts - Lock file: run/lock_v2_dynamic_imports.json diff --git a/tests/util/server/src/builders.rs b/tests/util/server/src/builders.rs index bf5de64dc..bd2d02f3f 100644 --- a/tests/util/server/src/builders.rs +++ b/tests/util/server/src/builders.rs @@ -387,6 +387,7 @@ pub struct TestCommandBuilder { args_text: String, args_vec: Vec, split_output: bool, + debug_output: bool, } impl TestCommandBuilder { @@ -406,6 +407,7 @@ impl TestCommandBuilder { command_name: "deno".to_string(), args_text: "".to_string(), args_vec: Default::default(), + debug_output: false, } } @@ -482,6 +484,16 @@ impl TestCommandBuilder { self } + /// Set this to enable streaming the output of the command to stderr. + /// + /// Not deprecated, this is just here so you don't accidentally + /// commit code with this enabled. + #[deprecated] + pub fn debug_output(mut self) -> Self { + self.debug_output = true; + self + } + pub fn stdin>(mut self, cfg: T) -> Self { self.stdin = Some(StdioContainer::new(cfg.into())); self @@ -606,10 +618,27 @@ impl TestCommandBuilder { } pub fn run(&self) -> TestCommandOutput { - fn read_pipe_to_string(mut pipe: os_pipe::PipeReader) -> String { - let mut output = String::new(); - pipe.read_to_string(&mut output).unwrap(); - output + fn read_pipe_to_string( + mut pipe: os_pipe::PipeReader, + output_to_stderr: bool, + ) -> String { + if output_to_stderr { + let mut buffer = vec![0; 512]; + let mut final_data = Vec::new(); + loop { + let size = pipe.read(&mut buffer).unwrap(); + if size == 0 { + break; + } + final_data.extend(&buffer[..size]); + std::io::stderr().write_all(&buffer[..size]).unwrap(); + } + String::from_utf8_lossy(&final_data).to_string() + } else { + let mut output = String::new(); + pipe.read_to_string(&mut output).unwrap(); + output + } } fn sanitize_output(text: String, args: &[OsString]) -> String { @@ -633,11 +662,16 @@ impl TestCommandBuilder { let (stderr_reader, stderr_writer) = pipe().unwrap(); command.stdout(stdout_writer); command.stderr(stderr_writer); + let debug_output = self.debug_output; ( None, Some(( - std::thread::spawn(move || read_pipe_to_string(stdout_reader)), - std::thread::spawn(move || read_pipe_to_string(stderr_reader)), + std::thread::spawn(move || { + read_pipe_to_string(stdout_reader, debug_output) + }), + std::thread::spawn(move || { + read_pipe_to_string(stderr_reader, debug_output) + }), )), ) } else { @@ -660,8 +694,9 @@ impl TestCommandBuilder { // and dropping it closes them. drop(command); - let combined = combined_reader - .map(|pipe| sanitize_output(read_pipe_to_string(pipe), &args)); + let combined = combined_reader.map(|pipe| { + sanitize_output(read_pipe_to_string(pipe, self.debug_output), &args) + }); let status = process.wait().unwrap(); let std_out_err = std_out_err_handle.map(|(stdout, stderr)| { diff --git a/tests/wpt/runner/expectation.json b/tests/wpt/runner/expectation.json index 44979f08b..cd11b1d42 100644 --- a/tests/wpt/runner/expectation.json +++ b/tests/wpt/runner/expectation.json @@ -8707,14 +8707,8 @@ "dynamic-import-with-assertion-argument.any.worker.html": true }, "json-module": { - "charset-bom.any.html": [ - "UTF-16BE BOM should result in parse error in JSON module script", - "UTF-16LE BOM should result in parse error in JSON module script" - ], - "charset-bom.any.worker.html": [ - "UTF-16BE BOM should result in parse error in JSON module script", - "UTF-16LE BOM should result in parse error in JSON module script" - ], + "charset-bom.any.html": true, + "charset-bom.any.worker.html": true, "invalid-content-type.any.html": true, "invalid-content-type.any.worker.html": true, "non-object.any.html": true, -- cgit v1.2.3