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