summaryrefslogtreecommitdiff
path: root/tests/unit_node/testdata/worker_module/cjs-file.cjs
blob: af2e21c3537722f46681ec77b621448aeeddbd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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();