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

docs: remove github-actions-cpu-cores recommendation #14421

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Chore & Maintenance

- `[docs]` Update `github-actions-cpu-cores` recommendation as unnecessary with Node 18 or newer ([#14421](https://github.com/jestjs/jest/pull/14421))

### Performance

## 29.6.2
Expand Down
18 changes: 8 additions & 10 deletions docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,16 @@ jest --maxWorkers=4
npm test -- --maxWorkers=4
```

If you use GitHub Actions, you can use [`github-actions-cpu-cores`](https://github.com/SimenB/github-actions-cpu-cores) to detect number of CPUs, and pass that to Jest.

```yaml
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1
- name: run tests
run: yarn jest --max-workers ${{ steps.cpu-cores.outputs.count }}
```
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could leave this and add an info section that it's necessary beyond 29.4.0


Another thing you can do is use the [`shard`](CLI.md#--shard) flag to parallelize the test run across multiple machines.

:::info

If your project uses Node 14 or 16, you can use you can use [`github-actions-cpu-cores`](https://github.com/SimenB/github-actions-cpu-cores) to accurately detect the number of CPUs to use.

Refer to [`github-actions-cpu-cores` README](https://github.com/SimenB/github-actions-cpu-cores#readme) for more information.

:::

## `coveragePathIgnorePatterns` seems to not have any effect.

Make sure you are not using the `babel-plugin-istanbul` plugin. Jest wraps Istanbul, and therefore also tells Istanbul what files to instrument with coverage collection. When using `babel-plugin-istanbul`, every file that is processed by Babel will have coverage collection code, hence it is not being ignored by `coveragePathIgnorePatterns`.
Expand Down