summaryrefslogtreecommitdiff
path: root/tests/unit_node/testdata/worker_module/cjs-file.cjs
diff options
context:
space:
mode:
authormash-graz <mash-graz@users.noreply.github.com>2024-03-20 04:42:22 +0100
committerGitHub <noreply@github.com>2024-03-20 09:12:22 +0530
commit0d43a63636c97886c10c6b8ce05fdb67cd2d8b91 (patch)
treec1bde8b36ec1d317f0d85ee7f40243169a2f4e2f /tests/unit_node/testdata/worker_module/cjs-file.cjs
parentb9f8562754f14aecfd87acdecfe8d8c966ccbe4d (diff)
fix(ext/node): worker_threads ESM handling (#22841)
Fixes #22840 Fixes #22964
Diffstat (limited to 'tests/unit_node/testdata/worker_module/cjs-file.cjs')
-rw-r--r--tests/unit_node/testdata/worker_module/cjs-file.cjs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit_node/testdata/worker_module/cjs-file.cjs b/tests/unit_node/testdata/worker_module/cjs-file.cjs
new file mode 100644
index 000000000..af2e21c35
--- /dev/null
+++ b/tests/unit_node/testdata/worker_module/cjs-file.cjs
@@ -0,0 +1,23 @@
+const { add } = require("./other_cjs_file.cjs");
+
+const missing_toplevel_async = async () => {
+ return new Promise((resolve) => {
+ setTimeout(() => {
+ resolve;
+ }, 500);
+ });
+};
+
+async function main() {
+ /// async code doesn't seem to work within this CJS wrapper :(
+ //const p = await missing_toplevel_async();
+
+ const sum = add(2, 3);
+ if (sum != 5) {
+ throw ("Bad calculator!");
+ }
+
+ postMessage("hallo");
+}
+
+main();