summaryrefslogtreecommitdiff
path: root/tests/unit_node/testdata/worker_module/cjs-file.cjs
diff options
context:
space:
mode:
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();