Combined Code Coverage
References
Setup Cypress Component & E2e coverage
Add the packages
yarn add -D @babel/plugin-transform-modules-commonjs @babel/preset-env @babel/preset-react @babel/preset-typescript @bahmutov/cypress-code-coverage @cypress/instrument-cra babel-loader istanbul istanbul-lib-coverage nycInstrument the app for E2e
"start": "react-scripts -r @cypress/instrument-cra start"Configure nyc for local coverage evaluation
nyc for local coverage evaluation"excludeAfterRemap": true,
"report-dir": "coverage-cy",
"reporter": ["text", "json", "html"],
"extension": [".ts", ".tsx", "js", "jsx"],
"include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.jsx", "src/**/*.js"],
"exclude": [
"any files you want excluded"
]Configure cypress.config.js for code coverage, instrument the app for component testing
cypress.config.js for code coverage, instrument the app for component testingConfigure both cypress/support/e2e.ts and cypress/support/component.ts
cypress/support/e2e.ts and cypress/support/component.tsAdd coverage convenience scripts to package.json
In the TS version there are no differences in local combined coverage, CodeCov service, Github Actions setup
jest to ignore cy.ts* files
jest to ignore cy.ts* filesRedundant source code
Coverage measurements


Addendum - configuration refactor
Addendum - code coverage with Vite instead of Webpack
Add the packages
Instrument the app (helps both E2e & CT)
Configure nyc for local coverage evaluation
nyc for local coverage evaluationConfigure cypress.config.js for code coverage, instrument the app for component testing
cypress.config.js for code coverage, instrument the app for component testingConfigure both cypress/support/e2e.ts and cypress/support/component.ts
cypress/support/e2e.ts and cypress/support/component.tsAdd coverage convenience scripts to package.json
Last updated