summaryrefslogtreecommitdiff
path: root/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable
diff options
context:
space:
mode:
authorMohammad Sulaiman <mohammad.sulaiman@exalt.ps>2024-11-05 08:39:05 +0200
committerGitHub <noreply@github.com>2024-11-05 06:39:05 +0000
commit89f0b796bd442ff352c3f93f69156ca6d85bfd5e (patch)
tree3ac2a58c6d85f6af57eb2c6b07b1f2d0e8687b3a /tests/specs/run/dynamic_import_concurrent_non_statically_analyzable
parentf9a05068d6de247574fb764044a446d1d7ed2e9b (diff)
chore: deprecate run itests (#26444)
Diffstat (limited to 'tests/specs/run/dynamic_import_concurrent_non_statically_analyzable')
-rw-r--r--tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc4
-rw-r--r--tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.out100
-rw-r--r--tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.ts16
-rw-r--r--tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/mod.ts7
4 files changed, 127 insertions, 0 deletions
diff --git a/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc
new file mode 100644
index 000000000..c4c30ca5d
--- /dev/null
+++ b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/__test__.jsonc
@@ -0,0 +1,4 @@
+{
+ "args": "run --allow-import --allow-read --allow-net --quiet dynamic_import_concurrent_non_statically_analyzable/main.ts",
+ "output": "dynamic_import_concurrent_non_statically_analyzable/main.out"
+}
diff --git a/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.out b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.out
new file mode 100644
index 000000000..c344d0aae
--- /dev/null
+++ b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/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/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.ts b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/main.ts
new file mode 100644
index 000000000..0832e40be
--- /dev/null
+++ b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/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/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/mod.ts b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/dynamic_import_concurrent_non_statically_analyzable/mod.ts
new file mode 100644
index 000000000..56f2002ed
--- /dev/null
+++ b/tests/specs/run/dynamic_import_concurrent_non_statically_analyzable/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));
+}