Create-react-app: allow setting of coverage reporters (or other jest config options)

Created on 10 Mar 2017  路  3Comments  路  Source: facebook/create-react-app

Normally, when using jest for testing in CI, we configure cobertura (so it can be parsed/visualized).
Usually we do this in our package.json

{
...
  "jest": {
    "coverageReporters": [
      "text",
      "cobertura"
    ]
  }
...
}

but this seems to be ignored when working with RCA.

I looked at perhaps using using react-scripts test -- --coverage --config ... to specify a config file for jest, but this yields a weird error:

> react-scripts test --env=jsdom --coverage --config=./jest/ci-conf.json

Error: Unknown config option "0" with value "./jest/ci-conf.json". This is either a typing error or a user mistake and fixing it will remove this message.

Specifying a config for jest is the worst case scenario, however, since it would require knowledge of what RCA normally provides. It would be much nicer to be able to override this in package.json

new feature

Most helpful comment

Please help beta test the new version that includes this change!
https://github.com/facebookincubator/create-react-app/issues/2172

All 3 comments

+1 , I need cobertura but don't want to eject from CRA

Please help beta test the new version that includes this change!
https://github.com/facebookincubator/create-react-app/issues/2172

Was this page helpful?
0 / 5 - 0 ratings