Skip to content

Commit

Permalink
other errors?
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Aug 6, 2020
1 parent ab6cb90 commit 8d089e4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/jest-worker/src/WorkerPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ import type {
WorkerPoolInterface,
} from './types';

const canUseWorkerThreads = () => {
const canUseWorkerThreads: () => boolean = () => {
try {
require('worker_threads');
return true;
} catch {
return false;
} catch (error) {
if (error.code === 'MODULE_NOT_FOUND') {
return false;
}

throw error;
}
};

Expand Down

0 comments on commit 8d089e4

Please sign in to comment.