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

Created on 5 Sep 2018  路  5Comments  路  Source: nrwl/nx

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

feature

Most helpful comment

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.

All 5 comments

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 馃憤

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

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

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
          }
      }
Was this page helpful?
0 / 5 - 0 ratings