summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/026_workers.ts6
-rw-r--r--cli/tests/026_workers.ts.out3
-rw-r--r--cli/tests/subdir/test_worker.js12
3 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/026_workers.ts b/cli/tests/026_workers.ts
index f45fc4b77..7ac1a0f32 100644
--- a/cli/tests/026_workers.ts
+++ b/cli/tests/026_workers.ts
@@ -11,4 +11,10 @@ jsWorker.onmessage = (e): void => {
tsWorker.postMessage("Hello World");
};
+jsWorker.onerror = (e: Event): void => {
+ e.preventDefault();
+ console.log("called onerror in script");
+ jsWorker.postMessage("Hello World");
+};
+
jsWorker.postMessage("Hello World");
diff --git a/cli/tests/026_workers.ts.out b/cli/tests/026_workers.ts.out
index 7538cc867..92f7550ad 100644
--- a/cli/tests/026_workers.ts.out
+++ b/cli/tests/026_workers.ts.out
@@ -1,4 +1,7 @@
Hello World
+called onerror in worker
+called onerror in script
+Hello World
Received js: Hello World
Hello World
Received ts: Hello World
diff --git a/cli/tests/subdir/test_worker.js b/cli/tests/subdir/test_worker.js
index 53d38ba96..cec5bdf9b 100644
--- a/cli/tests/subdir/test_worker.js
+++ b/cli/tests/subdir/test_worker.js
@@ -1,7 +1,19 @@
+let thrown = false;
+
onmessage = function(e) {
console.log(e.data);
+ if (thrown === false) {
+ thrown = true;
+ throw new SyntaxError("[test error]");
+ }
+
postMessage(e.data);
workerClose();
};
+
+onerror = function() {
+ console.log("called onerror in worker");
+ return false;
+};