blob: a7cf35db904fd9af22ede9dcc2b90be1f6c2e42c [file] [edit]
'use strict';
const common = require('../common');
const assert = require('assert');
const { Worker } = require('worker_threads');
const w = new Worker(`
require('worker_threads').parentPort.postMessage(performance.timeOrigin);
`, { eval: true });
w.on('message', common.mustCall((timeOrigin) => {
// PerformanceNodeTiming exposes process milestones so the
// `performance.timeOrigin` in the `worker_threads.Worker` must be the start
// time of the process.
assert.strictEqual(timeOrigin, performance.timeOrigin);
}));
w.on('exit', common.mustCall((code) => {
assert.strictEqual(code, 0);
}));