We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64847e3 commit 5634319Copy full SHA for 5634319
test/common/index.js
@@ -40,12 +40,11 @@ const noop = () => {};
40
const hasCrypto = Boolean(process.versions.openssl);
41
42
const isMainThread = (() => {
43
- try {
+ if (require('module').builtinModules.includes('worker_threads')) {
44
return require('worker_threads').isMainThread;
45
- } catch {
46
- // Worker module not enabled → only a single main thread exists.
47
- return true;
48
}
+ // Worker module not enabled → only a single main thread exists.
+ return true;
49
})();
50
51
// Check for flags. Skip this for workers (both, the `cluster` module and
0 commit comments