nx icon indicating copy to clipboard operation
nx copied to clipboard

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

Open johnRambo2k14 opened this issue 8 years ago • 6 comments

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

johnRambo2k14 avatar Sep 05 '18 16:09 johnRambo2k14

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 👍

skydever avatar Sep 07 '18 20:09 skydever

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

johnRambo2k14 avatar Sep 11 '18 11:09 johnRambo2k14

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.

FrozenPandaz avatar Sep 11 '18 19:09 FrozenPandaz

@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: https://github.com/facebook/jest/issues/7311

matheo avatar Feb 07 '19 21:02 matheo

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
          }
      }

demisx avatar Nov 25 '19 20:11 demisx

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[bot] avatar Mar 25 '23 08:03 github-actions[bot]