diff --git a/test/common/index.js b/test/common/index.js index c84933fd6eb3b3..ae9dceae94d69e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -46,13 +46,7 @@ const noop = () => {}; const hasCrypto = Boolean(process.versions.openssl); -const isMainThread = (() => { - if (require('module').builtinModules.includes('worker_threads')) { - return require('worker_threads').isMainThread; - } - // Worker module not enabled → only a single main thread exists. - return true; -})(); +const { isMainThread } = require('worker_threads'); // Check for flags. Skip this for workers (both, the `cluster` module and // `worker_threads`) and child processes.