summaryrefslogtreecommitdiff
path: root/cli/tests/subdir
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-01-29 18:54:23 +0100
committerGitHub <noreply@github.com>2020-01-29 18:54:23 +0100
commit161adfc51b750a7c8c62a898ea9948c2ad5b6cd9 (patch)
tree6d53db2a4acd30207372f665a3ba463e26db6fcf /cli/tests/subdir
parentd14864c57cebbd1d5bc18b8a9e05e522eb9987b0 (diff)
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into: - lib.deno.shared_globals.d.ts - lib.deno.window.d.ts - lib.deno.worker.d.ts * remove no longer used libs: - lib.deno_main.d.ts - lib.deno_worker.d.ts * change module loading to use proper TS library for compilation * align to Worker API spec: - Worker.terminate() - self.close() - self.name
Diffstat (limited to 'cli/tests/subdir')
-rw-r--r--cli/tests/subdir/bench_worker.ts2
-rw-r--r--cli/tests/subdir/test_worker.js7
-rw-r--r--cli/tests/subdir/test_worker.ts6
3 files changed, 12 insertions, 3 deletions
diff --git a/cli/tests/subdir/bench_worker.ts b/cli/tests/subdir/bench_worker.ts
index 696a84b9f..619a35fa2 100644
--- a/cli/tests/subdir/bench_worker.ts
+++ b/cli/tests/subdir/bench_worker.ts
@@ -15,7 +15,7 @@ onmessage = function(e): void {
break;
case 3: // Close
postMessage({ cmdId: 3 });
- workerClose();
+ close();
break;
}
};
diff --git a/cli/tests/subdir/test_worker.js b/cli/tests/subdir/test_worker.js
index cec5bdf9b..f0d9fbed6 100644
--- a/cli/tests/subdir/test_worker.js
+++ b/cli/tests/subdir/test_worker.js
@@ -1,5 +1,10 @@
let thrown = false;
+// TODO(bartlomieju): add test for throwing in web worker
+if (self.name !== "jsWorker") {
+ throw Error(`Bad worker name: ${self.name}, expected jsWorker`);
+}
+
onmessage = function(e) {
console.log(e.data);
@@ -10,7 +15,7 @@ onmessage = function(e) {
postMessage(e.data);
- workerClose();
+ close();
};
onerror = function() {
diff --git a/cli/tests/subdir/test_worker.ts b/cli/tests/subdir/test_worker.ts
index c8109d131..bc3f358f8 100644
--- a/cli/tests/subdir/test_worker.ts
+++ b/cli/tests/subdir/test_worker.ts
@@ -1,7 +1,11 @@
+if (self.name !== "tsWorker") {
+ throw Error(`Invalid worker name: ${self.name}, expected tsWorker`);
+}
+
onmessage = function(e): void {
console.log(e.data);
postMessage(e.data);
- workerClose();
+ close();
};