diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/subdir/worker_crypto.js | 3 | ||||
-rw-r--r-- | cli/tests/workers_test.ts | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/subdir/worker_crypto.js b/cli/tests/subdir/worker_crypto.js new file mode 100644 index 000000000..a86340005 --- /dev/null +++ b/cli/tests/subdir/worker_crypto.js @@ -0,0 +1,3 @@ +onmessage = function () { + postMessage(!!self.crypto); +}; diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts index c4b93db3c..df2cdf2aa 100644 --- a/cli/tests/workers_test.ts +++ b/cli/tests/workers_test.ts @@ -290,3 +290,20 @@ Deno.test({ await promise2; }, }); + +Deno.test({ + name: "worker with crypto in scope", + fn: async function (): Promise<void> { + const promise = createResolvable(); + const w = new Worker("../tests/subdir/worker_crypto.js", { + type: "module", + }); + w.onmessage = (e): void => { + assertEquals(e.data, true); + promise.resolve(); + }; + w.postMessage(null); + await promise; + w.terminate(); + }, +}); |