summaryrefslogtreecommitdiff
path: root/test/parallel/test-worker-relative-path-double-dot.js
blob: 86707c1590480e8062964d1ca09868f0556e0240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const common = require('../common');
const path = require('path');
const assert = require('assert');
const { Worker, isMainThread, parentPort } = require('worker_threads');

if (isMainThread) {
  const cwdName = path.relative('../', '.');
  const relativePath = path.relative('.', __filename);
  const w = new Worker(path.join('..', cwdName, relativePath));
  w.on('message', common.mustCall((message) => {
    assert.strictEqual(message, 'Hello, world!');
  }));
} else {
  parentPort.postMessage('Hello, world!');
}