Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest-worker has no workers by default with one CPU #7181

Closed
biomedia-thomas opened this issue Oct 16, 2018 · 2 comments · Fixed by #7182
Closed

Jest-worker has no workers by default with one CPU #7181

biomedia-thomas opened this issue Oct 16, 2018 · 2 comments · Fixed by #7182

Comments

@biomedia-thomas
Copy link
Contributor

🐛 Bug Report

jest-workers default for numWorkers is the number of CPUs minus 1. When there is only one CPU this results in a default numWorkers of 0 and no workers will be started.

To Reproduce

On a setup with only one CPU, use jest-worker with numWorkers option left to default. No workers are started:

const Worker = require('jest-worker').default;

// Ouputs OS platform:
new Worker(require.resolve('os'), {numWorkers: 1}).platform().then((a) => {
    console.log(a);
});

// Endlessly pending promise:
new Worker(require.resolve('os')).platform().then((a) => {
    console.log(a);
}); 

Expected behavior

Jest-worker using at least one worker in the default case.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Linux 4.9 Debian GNU/Linux 8 (jessie) 8 (jessie)
    CPU: x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  Binaries:
    Node: 8.12.0 - /usr/local/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
@thymikee
Copy link
Collaborator

thymikee commented Oct 16, 2018

Mind sending a fix that falls back the cpus to 1? 😄

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants