Skip to content

Commit

Permalink
Use at least one worker by default (fixes #7181) (#7182)
Browse files Browse the repository at this point in the history
  • Loading branch information
biomedia-thomas authored and rubennorte committed Oct 16, 2018
1 parent 081e155 commit e5441f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/jest-runtime/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function run(cliArgv?: Argv, cliInfo?: Array<string>) {
unmockedModulePathPatterns: null,
});
Runtime.createContext(config, {
maxWorkers: os.cpus().length - 1,
maxWorkers: Math.max(os.cpus().length - 1, 1),
watchman: globalConfig.watchman,
})
.then(hasteMap => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class {
_offset: number;

constructor(workerPath: string, options?: FarmOptions = {}) {
const numWorkers = options.numWorkers || os.cpus().length - 1;
const numWorkers = options.numWorkers || Math.max(os.cpus().length - 1, 1);
const workers = new Array(numWorkers);
const stdout = mergeStream();
const stderr = mergeStream();
Expand Down

0 comments on commit e5441f9

Please sign in to comment.