Test suite
reusable and easy to use jest test suite
Usage
npm i -D @namics/test-suite
This packages uses jest and enzyme please read their documentations for details. Most parts are copied from the Create React App unit test solution.
package.json
...
"scripts": {
"test": "test-suite --coverage",
"test:dev": "test-suite",
...
},
...
Collect Coverage
package.json
"jest": {
"collectCoverageFrom": [
"src/**/*.{js|jsx|ts|tsx}",
"!src/**/*.stories.{js|jsx|ts|tsx}",
"!src/dev.ts",
"!src/index.tsx"
]
},
allowed configurations:
key | documentation |
---|---|
collectCoverageFrom | https://jestjs.io/docs/en/configuration#collectcoveragefrom-array |
coverageReporters | https://jestjs.io/docs/en/configuration#coveragereporters-array-string |
coverageThreshold | https://jestjs.io/docs/en/configuration#coveragethreshold-object |
resetMocks | https://jestjs.io/docs/en/configuration#resetmocks-boolean |
resetModules | https://jestjs.io/docs/en/configuration#resetmodules-boolean |
snapshotSerializers | https://jestjs.io/docs/en/configuration#snapshotserializers-array-string |
watchPathIgnorePatterns | https://jestjs.io/docs/en/configuration#watchpathignorepatterns-array-string |