dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.

Home Page:https://craco.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jest coverage options not used

devChrisho opened this issue · comments

What's happening
running jest test coverage fails to generate cobertura report. It defaults to lcov. It seems to be completely ignoring all the coverage configurations

What should happen
it should generate cobertura or any other report type that is passed into coverageReporters

To reproduce
npm run test --coverage

CRACO version
6.4.5

CRACO config
module.exports = {
babel: {
presets: ["@babel/preset-env"],
},
jest: {
configure: {
preset: "ts-jest",
testEnvironment: "node",
collectCoverage: true,
coverageReporters: ["html", "cobertura"],
collectCoverageFrom: [
"src//*.{js,jsx,ts,tsx}",
"!src/index.tsx",
"!src/
/setupTests.{js,jsx,ts,tsx}",
"!src//serviceWorker.{js,jsx,ts,tsx}",
"!src/
/.(spec|test|stories).{js,jsx,ts,tsx}",
"!src/ui/appointment/components/forms/MammogramRequestForm/**/
.{js,jsx,ts,tsx}",
],
coveragePathIgnorePatterns: [
"node_modules",
".mock.ts",
".mocks.ts",
".style.ts",
".styles.ts",
".css",
],
transform: {
"^.+\.ts?$": "ts-jest",
},
transformIgnorePatterns: ["/node_modules/(?!axios)"],
},
},
};

package.json
"dependencies": {
"@date-io/date-fns": "^1.3.13",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.61",
"@material-ui/pickers": "^3.3.10",
"@reduxjs/toolkit": "^1.8.2",
"axios": "^1.3.6",
"browser-image-compression": "^2.0.0",
"classnames": "^2.3.1",
"date-fns": "^2.28.0",
"deepmerge": "^4.2.2",
"env-cmd": "^10.1.0",
"firebase": "^7.14.2",
"he": "^1.2.0",
"html-react-parser": "^1.4.12",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-infinite-scroll-component": "^6.1.0",
"react-js-pull-to-refresh": "^1.2.3",
"react-material-ui-carousel": "^2.3.11",
"react-redux": "^8.0.2",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-show-more-text": "^1.5.2",
"react-sizeme": "^3.0.2",
"react-string-replace": "^1.1.0",
"react-window": "^1.8.7",
"react-zoom-pan-pinch": "^2.1.3",
"redux": "^4.2.0",
"redux-persist": "^6.0.0",
"ts-nameof": "^5.0.0",
"typescript": "^4.3.2"
},
"devDependencies": {
"@craco/craco": "^6.4.5",
"@craco/types": "^7.1.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@testing-library/react-hooks": "^8.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/dateformat": "^5.0.0",
"@types/enzyme": "^3.10.12",
"@types/he": "^1.1.2",
"@types/jest": "^27.5.1",
"@types/node": "^14.0.1",
"@types/react": "^17.0.44",
"@types/react-dom": "^17.0.16",
"@types/react-router-dom": "^5.1.3",
"@types/react-show-more-text": "^1.4.2",
"@types/react-slick": "^0.23.8",
"@types/react-window": "^1.8.5",
"@types/redux-mock-store": "^1.0.3",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
"babel-plugin-macros": "^3.1.0",
"cra-bundle-analyzer": "^0.1.1",
"cross-env": "^7.0.3",
"enzyme": "^3.11.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-jest-dom": "^4.0.1",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
"if-node-version": "^1.1.1",
"jest-environment-jsdom": "^28.1.0",
"jest-environment-jsdom-sixteen": "^2.0.0",
"jest-junit": "^16.0.0",
"lint-staged": "^12.4.2",
"prettier": "^2.6.2",
"react-scripts": "^4.0.3",
"react-test-renderer": "^18.1.0",
"redux-mock-store": "^1.5.4",
"ts-nameof.macro": "^4.2.2"
},

Additional information
(anything else that could be useful for us to help you solve your problem)