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

[feature] Ability to pass through options to jest via ng test #754

Closed
johnRambo2k14 opened this issue Sep 5, 2018 · 6 comments · Fixed by #757
Closed

[feature] Ability to pass through options to jest via ng test #754

johnRambo2k14 opened this issue Sep 5, 2018 · 6 comments · Fixed by #757

Comments

@johnRambo2k14
Copy link

I'm currently experiencing issues where my CI memory limit is being maxed since jest sets a worker for each existing CPU.

It would be great if I can pass in Jest CLI options through including --runInBand

A full list of CLI commands can be found here:

https://jestjs.io/docs/en/cli.html

@skydever
Copy link
Contributor

skydever commented Sep 7, 2018

hi @johnRambo2k14,

do you also set a --maxParallel parameter when you run affected:test, if that is the way how you start the tests via CI? but yes, setting all the cli params in angular.json to pass through to jest would be great 👍

@johnRambo2k14
Copy link
Author

Ah that totally escaped me! I haven't tested it out with jest just yet, I will let you know my findings.

@FrozenPandaz
Copy link
Collaborator

FrozenPandaz commented Sep 11, 2018

I will add runInBand and maxWorkers as per this troubleshooting docs from jest docs.

I am holding off on passing every option into jest as there may be some which are not applicable. Having these options defined in our schema is important for ng test jest-project --help. Adding options is relatively easy to do, so we will keep maintaining it this way for the time being.

bcabanes pushed a commit that referenced this issue Sep 14, 2018
Fixes #754

## Current Behavior

`runInBand` and `maxWorkers` are useful for CI environments but are not available through the builder.

## Expected Behavior

Both `runInBand` and `maxWorkers` have been added and can be used as per [Jest Troubleshooting](https://jestjs.io/docs/en/troubleshooting#tests-are-extremely-slow-on-docker-and-or-continuous-integration-ci-server).

```sh
  --max-workers
    Max number of workers to run tests across. Useful for CI. (https://jestjs.io/docs/en/cli.html#maxworkers-num)
  --run-in-band
    Run tests in a single process as opposed to multiple workers. Useful for CI. (https://jestjs.io/docs/en/cli.html#runinband)
```
@matheo
Copy link
Contributor

matheo commented Feb 7, 2019

@FrozenPandaz the runInBand and maxWorkers (2) are there by default now?
I'm having memory problems with CircleCI and I'm wondering how to address this with Nx

It seems a core issue of jest ATM, related with graceful-fs:
jestjs/jest#7311

@demisx
Copy link

demisx commented Nov 25, 2019

Just to clarify, the runInBand option needs to be set in angular.json:

     "e2e": {
          "builder": "@nrwl/jest:jest",
          "options": {
            "jestConfig": "apps/api-e2e/jest.config.js",
            "tsConfig": "apps/api-e2e/tsconfig.spec.json",
            "runInBand": true
          }
      }

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

5 participants