summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/run/followup_dyn_import_resolves
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-09-19 09:32:21 -0500
committerGitHub <noreply@github.com>2022-09-19 10:32:21 -0400
commit1464b756a4ef091ef97d1bf7340188ab5fe5492a (patch)
tree2eff346ccf5782c501460aec63a5028742066fa6 /cli/tests/testdata/run/followup_dyn_import_resolves
parent8d50c09c0db4e9b0644263cde3f7ff990ec75259 (diff)
refactor: move out test files from root testdata directory into sub directories (#15949)
Diffstat (limited to 'cli/tests/testdata/run/followup_dyn_import_resolves')
-rw-r--r--cli/tests/testdata/run/followup_dyn_import_resolves/main.ts14
-rw-r--r--cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out3
-rw-r--r--cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts2
-rw-r--r--cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts1
4 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts
new file mode 100644
index 000000000..a8508f942
--- /dev/null
+++ b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts
@@ -0,0 +1,14 @@
+// https://github.com/denoland/deno/issues/14726
+
+// Any dynamic modules that are only pending on a TLA import should be resolved
+// in the same event loop iteration as the imported module.
+
+// Long-running timer so the event loop doesn't have a next iteration for a
+// while.
+setTimeout(() => {}, 24 * 60 * 60 * 1000);
+
+await import("./sub1.ts");
+
+// If we reach here, the test is passed.
+console.log("Done.");
+Deno.exit();
diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out
new file mode 100644
index 000000000..a19976d4a
--- /dev/null
+++ b/cli/tests/testdata/run/followup_dyn_import_resolves/main.ts.out
@@ -0,0 +1,3 @@
+sub2
+sub1
+Done.
diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts
new file mode 100644
index 000000000..d06c30221
--- /dev/null
+++ b/cli/tests/testdata/run/followup_dyn_import_resolves/sub1.ts
@@ -0,0 +1,2 @@
+await import("./sub2.ts");
+console.log("sub1");
diff --git a/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts b/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts
new file mode 100644
index 000000000..cce2b524c
--- /dev/null
+++ b/cli/tests/testdata/run/followup_dyn_import_resolves/sub2.ts
@@ -0,0 +1 @@
+console.log("sub2");