mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
a8c3d03df0
PR-URL: https://github.com/nodejs/node/pull/46588 Fixes: https://github.com/nodejs/node/issues/45958 Refs: https://github.com/nodejs/node/pull/43781 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
21 lines
608 B
JavaScript
21 lines
608 B
JavaScript
'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);
|
|
}));
|