diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/bundle.test.out | 43 | ||||
-rw-r--r-- | cli/tests/bundle_dynamic_import.ts | 3 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 7 | ||||
-rw-r--r-- | cli/tests/lock_check_err_with_bundle.out | 5 |
4 files changed, 33 insertions, 25 deletions
diff --git a/cli/tests/bundle.test.out b/cli/tests/bundle.test.out index eba439424..d90dc9f95 100644 --- a/cli/tests/bundle.test.out +++ b/cli/tests/bundle.test.out @@ -1,22 +1,23 @@ [WILDCARD] -let System, __instantiate; -(() => { -[WILDCARD] -})(); - -System.register("print_hello", [], function (exports_1, context_1) { -[WILDCARD] -}); -System.register("subdir2/mod2", ["print_hello"], function (exports_2, context_2) { -[WILDCARD] -}); -System.register("mod1", ["subdir2/mod2"], function (exports_3, context_3) { -[WILDCARD] -}); - -const __exp = __instantiate("mod1", false); -export const returnsHi = __exp["returnsHi"]; -export const returnsFoo2 = __exp["returnsFoo2"]; -export const printHello3 = __exp["printHello3"]; -export const throwsError = __exp["throwsError"]; -[WILDCARD] +function printHello() { + console.log("Hello"); +} +function returnsFoo() { + return "Foo"; +} +function printHello2() { + printHello(); +} +export function returnsHi() { + return "Hi"; +} +export function returnsFoo2() { + return returnsFoo(); +} +export function printHello3() { + printHello2(); +} +export function throwsError() { + throw Error("exception from mod1"); +} +[WILDCARD]
\ No newline at end of file diff --git a/cli/tests/bundle_dynamic_import.ts b/cli/tests/bundle_dynamic_import.ts new file mode 100644 index 000000000..754831632 --- /dev/null +++ b/cli/tests/bundle_dynamic_import.ts @@ -0,0 +1,3 @@ +const mod1 = await import("http://localhost:4545/cli/tests/subdir/mod1.ts"); + +mod1.printHello3(); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index b9264aa0f..11240e71b 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1017,11 +1017,12 @@ fn bundle_js() { #[test] fn bundle_dynamic_import() { + let _g = util::http_server(); let dynamic_import = - util::root_path().join("cli/tests/subdir/subdir2/dynamic_import.ts"); + util::root_path().join("cli/tests/bundle_dynamic_import.ts"); assert!(dynamic_import.is_file()); let t = TempDir::new().expect("tempdir fail"); - let bundle = t.path().join("dynamic_import.bundle.js"); + let bundle = t.path().join("bundle_dynamic_import.bundle.js"); let mut deno = util::deno_cmd() .current_dir(util::root_path()) .arg("bundle") @@ -1036,6 +1037,8 @@ fn bundle_dynamic_import() { let output = util::deno_cmd() .current_dir(util::root_path()) .arg("run") + .arg("--allow-net") + .arg("--quiet") .arg(&bundle) .output() .expect("failed to spawn script"); diff --git a/cli/tests/lock_check_err_with_bundle.out b/cli/tests/lock_check_err_with_bundle.out index ce0e029ef..d6eae26b1 100644 --- a/cli/tests/lock_check_err_with_bundle.out +++ b/cli/tests/lock_check_err_with_bundle.out @@ -1,3 +1,4 @@ [WILDCARD] -Subresource integrity check failed --lock=lock_check_err_with_bundle.json -http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts +The source code is invalid, as it does not match the expected hash in the lock file. + Specifier: http://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts + Lock file: lock_check_err_with_bundle.json |