diff options
Diffstat (limited to 'cli/tests')
4 files changed, 129 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 012b744ba..c72fa5d9b 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -545,6 +545,12 @@ itest!(dynamic_import_already_rejected { output: "run/dynamic_import_already_rejected/main.out", }); +itest!(dynamic_import_concurrent_non_statically_analyzable { + args: "run --allow-read --allow-net --quiet run/dynamic_import_concurrent_non_statically_analyzable/main.ts", + output: "run/dynamic_import_concurrent_non_statically_analyzable/main.out", + http_server: true, +}); + itest!(no_check_imports_not_used_as_values { args: "run --config run/no_check_imports_not_used_as_values/preserve_imports.tsconfig.json --no-check run/no_check_imports_not_used_as_values/main.ts", output: "run/no_check_imports_not_used_as_values/main.out", diff --git a/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out new file mode 100644 index 000000000..c344d0aae --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out @@ -0,0 +1,100 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 diff --git a/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts new file mode 100644 index 000000000..0832e40be --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts @@ -0,0 +1,16 @@ +import * as path from "http://localhost:4545/deno_std/path/mod.ts"; + +const currentDir = path.dirname(path.fromFileUrl(import.meta.url)); +const url = path.toFileUrl(path.join(currentDir, "./mod.ts")); +const urls = []; + +// this is hard to reproduce, but doing this will help +for (let i = 0; i < 100; i++) { + urls.push(url.toString() + "#" + i); +} + +const results = await Promise.all(urls.map((url) => import(url))); + +for (const result of results) { + result.outputValue(); +} diff --git a/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts new file mode 100644 index 000000000..56f2002ed --- /dev/null +++ b/cli/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts @@ -0,0 +1,7 @@ +// sleep a bit so many concurrent tasks end up +// attempting to build the graph at the same time +import "http://localhost:4545/sleep/10"; + +export function outputValue() { + console.log(parseInt(new URL(import.meta.url).hash.slice(1), 10)); +} |