summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-08-18 15:19:22 +0200
committerGitHub <noreply@github.com>2021-08-18 15:19:22 +0200
commita66218d457859fc3498db9fbc61228c74f490cc2 (patch)
treecf099a0d7cfaeb5e6c10d55473bfc0b4ceb9c8d9 /cli/tests
parent480cfda8d5a5560fe0cc3ac2d9a3b798bf23f060 (diff)
fix(runtime): event loop panics in classic workers (#11756)
Classic worker scripts are now executed in the context of a Tokio runtime. This does mean we can not spawn more tokio runtimes in "op_worker_sync_fetch". We instead spawn a new thread there, that can create a new Tokio runtime that we can use to block the worker thread.
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/run_tests.rs7
-rw-r--r--cli/tests/testdata/classic_workers_event_loop.js4
-rw-r--r--cli/tests/testdata/classic_workers_event_loop.js.out1
3 files changed, 12 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index c7e0325ec..981b85199 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -1109,6 +1109,13 @@ itest!(import_file_with_colon {
output: "import_file_with_colon.ts.out",
http_server: true,
});
+
+itest!(classic_workers_event_loop {
+ args:
+ "run --enable-testing-features-do-not-use classic_workers_event_loop.js",
+ output: "classic_workers_event_loop.js.out",
+});
+
// FIXME(bartlomieju): disabled, because this test is very flaky on CI
// itest!(local_sources_not_cached_in_memory {
// args: "run --allow-read --allow-write no_mem_cache.js",
diff --git a/cli/tests/testdata/classic_workers_event_loop.js b/cli/tests/testdata/classic_workers_event_loop.js
new file mode 100644
index 000000000..810a6df7f
--- /dev/null
+++ b/cli/tests/testdata/classic_workers_event_loop.js
@@ -0,0 +1,4 @@
+new Worker(
+ "data:application/javascript,setTimeout(() => {console.log('done'); self.close()}, 1000)",
+ { type: "classic" },
+);
diff --git a/cli/tests/testdata/classic_workers_event_loop.js.out b/cli/tests/testdata/classic_workers_event_loop.js.out
new file mode 100644
index 000000000..19f86f493
--- /dev/null
+++ b/cli/tests/testdata/classic_workers_event_loop.js.out
@@ -0,0 +1 @@
+done