Repository navigation
Support Jest coverageThreshold option #922
Description
Activity
Any insights on this ? Could be nice to provide custom config to Jest :)
Reacted by Matt LaytonI would really like to be able to use the jest config options in package.json. Some of the defaults (such as bail=false) are very, very annoying. I don't think this would create much entropy.
Reacted by Gael Ollivier and jasonnetSome of the defaults (such as bail=false) are very, very annoying.
File an issue and describe your use case? It’s really hard to guess that something is “very annoying” if nobody tells us about it. 😉 A lot of those might not be conscious decisions so you should question them in issues by explaining your use cases.
Reacted by Baptiste Mathus@gaearon What about the
coverageTresholdthen ? I don't think it can be a default, that's something that must be decided for each projectReacted by Thomas Lacroix@gaelduplessix We intend to add some configurability in the future. I'm not closing the issue but now is not the time yet. Perhaps in a few months when more things shake out (e.g. Jest has been going through a ton of changes recently).
Reacted by Gael Ollivier and de ville weppenaarJest configurability would be excellent, thanks!
For now, this is how we achieve coverage threshold checking on CI:
"coverage": "CI=true npm t -- --coverage", "postcoverage": "istanbul check-coverage --statements 90 --functions 90 --branches 90 --lines 90",
Reacted by Joel McMurray, Gael Ollivier, Marcelo rizzardo lima, Marco Arduini and StavrosChiming in here (or should I raise a new issue?), but I'd like to be able to set the
shapshotSerializersoption for Jest so I can use enzyme and snapshot testing together transparently. See: https://www.npmjs.com/package/jest-serializer-enzymeThis would be trivial, if create-react-app allowed Jest configuration in package.json.
Naively, I'm wondering if utils/createJestConfig.js could be updated to merge package.json config if it exists. Something like:
const config = { collectCoverageFrom: ['src/**/*.{js,jsx}'], /* ... */ }; if (rootDir) { config.rootDir = rootDir; } return { ...config, ...packageJson.jest, };
Reacted by Andris Sīlis@jagregory You should be able to use
expect.addSnapshotSerializer()insrc/setupTests.jsinstead. Let me know if that works.@gaearon Do you know which Jest version that function is available? I'm using CRA 0.9.5, which has Jest 18.1.0, and I'm getting
undefined functionforexpect.addSnapshotSerializer.Looks like
addSnapshotSerializerwas added in Jest 19 which will be out in one of our 0.10 alpha releases, and (for sure) the stable.This is configurable in the next version.
#1830Please help beta test the new version that includes this change!
#2172Reacted by Gael Ollivier- locked and limited conversation to collaborators
on Jan 21, 2019
I would like to configure the coverage threshold from
jestto be able to launch jenkins from CI with a 90-100% coverage.Can we have support for this in Create react app ?
What is the most relevant:
--config="{}"frompackage.json?