summaryrefslogtreecommitdiff
path: root/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-10 13:22:13 -0700
committerGitHub <noreply@github.com>2024-02-10 20:22:13 +0000
commitf5e46c9bf2f50d66a953fa133161fc829cecff06 (patch)
tree8faf2f5831c1c7b11d842cd9908d141082c869a5 /tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable
parentd2477f780630a812bfd65e3987b70c0d309385bb (diff)
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.
Diffstat (limited to 'tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable')
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out100
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts16
-rw-r--r--tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts7
3 files changed, 123 insertions, 0 deletions
diff --git a/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.out
new file mode 100644
index 000000000..c344d0aae
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/main.ts
new file mode 100644
index 000000000..0832e40be
--- /dev/null
+++ b/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/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts b/tests/testdata/run/dynamic_import_concurrent_non_statically_analyzable/mod.ts
new file mode 100644
index 000000000..56f2002ed
--- /dev/null
+++ b/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));
+}