Skip to content

Commit a29adef

Browse files
Trottaddaleax
authored andcommitted
test,worker: simplify common.isMainThread
Now that `worker_threads` do not require a flag, the logic around loading `isMainThread` can be removed. PR-URL: #25426 Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent f0409be commit a29adef

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

test/common/index.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ const noop = () => {};
4646

4747
const hasCrypto = Boolean(process.versions.openssl);
4848

49-
const isMainThread = (() => {
50-
if (require('module').builtinModules.includes('worker_threads')) {
51-
return require('worker_threads').isMainThread;
52-
}
53-
// Worker module not enabled → only a single main thread exists.
54-
return true;
55-
})();
49+
const { isMainThread } = require('worker_threads');
5650

5751
// Check for flags. Skip this for workers (both, the `cluster` module and
5852
// `worker_threads`) and child processes.

0 commit comments

Comments
 (0)