diff options
Diffstat (limited to 'tests')
113 files changed, 747 insertions, 241 deletions
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/testdata/bundle/lockfile/check_error.json b/tests/specs/bundle/lockfile/check_error.json index a218d7000..a218d7000 100644 --- a/tests/testdata/bundle/lockfile/check_error.json +++ b/tests/specs/bundle/lockfile/check_error.json 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/testdata/run/auto_discover_lockfile/deno.json b/tests/specs/lockfile/auto_discover_lockfile/deno.json index 90faa728a..90faa728a 100644 --- a/tests/testdata/run/auto_discover_lockfile/deno.json +++ b/tests/specs/lockfile/auto_discover_lockfile/deno.json diff --git a/tests/testdata/run/auto_discover_lockfile/deno.lock b/tests/specs/lockfile/auto_discover_lockfile/deno.lock index 059f66789..059f66789 100644 --- a/tests/testdata/run/auto_discover_lockfile/deno.lock +++ b/tests/specs/lockfile/auto_discover_lockfile/deno.lock 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/testdata/run/auto_discover_lockfile/main.ts b/tests/specs/lockfile/auto_discover_lockfile/main.ts index baa52775d..baa52775d 100644 --- a/tests/testdata/run/auto_discover_lockfile/main.ts +++ b/tests/specs/lockfile/auto_discover_lockfile/main.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/testdata/run/config_file_lock_boolean/deno.lock b/tests/specs/lockfile/config_file_lock_boolean/deno.lock index 059f66789..059f66789 100644 --- a/tests/testdata/run/config_file_lock_boolean/deno.lock +++ b/tests/specs/lockfile/config_file_lock_boolean/deno.lock diff --git a/tests/testdata/run/config_file_lock_boolean/false.json b/tests/specs/lockfile/config_file_lock_boolean/false.json index 358b7d299..358b7d299 100644 --- a/tests/testdata/run/config_file_lock_boolean/false.json +++ b/tests/specs/lockfile/config_file_lock_boolean/false.json diff --git a/tests/testdata/run/config_file_lock_boolean/false.main.out b/tests/specs/lockfile/config_file_lock_boolean/false.main.out index 0d8f0a237..0d8f0a237 100644 --- a/tests/testdata/run/config_file_lock_boolean/false.main.out +++ b/tests/specs/lockfile/config_file_lock_boolean/false.main.out diff --git a/tests/testdata/run/config_file_lock_boolean/main.ts b/tests/specs/lockfile/config_file_lock_boolean/main.ts index baa52775d..baa52775d 100644 --- a/tests/testdata/run/config_file_lock_boolean/main.ts +++ b/tests/specs/lockfile/config_file_lock_boolean/main.ts diff --git a/tests/testdata/run/config_file_lock_boolean/true.json b/tests/specs/lockfile/config_file_lock_boolean/true.json index 090481af9..090481af9 100644 --- a/tests/testdata/run/config_file_lock_boolean/true.json +++ b/tests/specs/lockfile/config_file_lock_boolean/true.json 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/testdata/run/config_file_lock_path.json b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.json index 2c393f76e..2c393f76e 100644 --- a/tests/testdata/run/config_file_lock_path.json +++ b/tests/specs/lockfile/config_file_lock_path/config_file_lock_path.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/testdata/run/lock_check_err.json b/tests/specs/lockfile/lock_check_err/lock_check_err.json index fc6c2d45c..fc6c2d45c 100644 --- a/tests/testdata/run/lock_check_err.json +++ b/tests/specs/lockfile/lock_check_err/lock_check_err.json 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/testdata/run/lock_dynamic_imports.json b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json index 0269b9409..0269b9409 100644 --- a/tests/testdata/run/lock_dynamic_imports.json +++ b/tests/specs/lockfile/lock_dynamic_imports/lock_dynamic_imports.json 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/testdata/run/lock_v2_check_err.json b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json index 6bd6491c6..6bd6491c6 100644 --- a/tests/testdata/run/lock_v2_check_err.json +++ b/tests/specs/lockfile/lock_v2_check_err/lock_v2_check_err.json 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/testdata/run/lock_v2_check_err2.json b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json index 30fbcdf4b..30fbcdf4b 100644 --- a/tests/testdata/run/lock_v2_check_err2.json +++ b/tests/specs/lockfile/lock_v2_check_err2/lock_v2_check_err2.json 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/testdata/run/lock_v2_dynamic_imports.json b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json index eadbee272..eadbee272 100644 --- a/tests/testdata/run/lock_v2_dynamic_imports.json +++ b/tests/specs/lockfile/lock_v2_dynamic_imports/lock_v2_dynamic_imports.json 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/testdata/npm/lock_file/lock.json b/tests/specs/npm/lock_file_integrity_failure/lock.json index 57253314e..57253314e 100644 --- a/tests/testdata/npm/lock_file/lock.json +++ b/tests/specs/npm/lock_file_integrity_failure/lock.json diff --git a/tests/testdata/npm/lock_file/main.js b/tests/specs/npm/lock_file_integrity_failure/main.js index a7b5960ca..a7b5960ca 100644 --- a/tests/testdata/npm/lock_file/main.js +++ b/tests/specs/npm/lock_file_integrity_failure/main.js diff --git a/tests/testdata/npm/lock_file/main.out b/tests/specs/npm/lock_file_integrity_failure/main.out index dead1a623..741edd9d2 100644 --- a/tests/testdata/npm/lock_file/main.out +++ b/tests/specs/npm/lock_file_integrity_failure/main.out @@ -9,4 +9,4 @@ 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". +Use the --lock-write flag to regenerate the lockfile at "[WILDCARD]lock.json". 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/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/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.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.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.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.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.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.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<String>, 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<T: Into<Stdio>>(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, |