@monorepo-template/cypress-coverage-config-override
TypeScript icon, indicating that this package has built-in type declarations

1.2.5 • Public • Published

Cypress coverage config-override

Cypress coverage config-override is a react-app-rewired config override that enables coverage for Cypress tests.

Install

This package relies on babel-plugin-istanbul for generating coverage reports.

yarn add --dev "@monorepo-template/cypress-coverage-config-override" babel-plugin-istanbul

Use

Bootstrap your React application with Cypress coverage by using react-app-rewired's config-overrides.js file.

const cypressConfigOverride = require('@monorepo-template/cypress-coverage-config-override');

module.exports = function override(config, env) {
  // For non-development environments, do not monitor code coverage.
  if (env !== 'development') {
    return config;
  }

  return cypressConfigOverride(config);
};

Custom tsconfig.json

By default, Cypress's tsconfig.json file must be located at cypress/tsconfig.json. To change this location, set the CYPRESS_TSCONFIG_PATH environment variable.

For example,

CYPRESS_TSCONFIG_PATH=./tsconfig.cypress.json

Credit

This package was inspired by @cypress/instrument-cra and much of this package's logic is pulled from @cypress/instrument-cra's source code.

@cypress/instrument-cra's path resolution does not support Yarn 2 plug-and-play, so this package attempts to achieve the same goal by replacing @cypress/instrument-cra's path resolution with that of react-app-rewired's.

Readme

Keywords

none

Package Sidebar

Install

npm i @monorepo-template/cypress-coverage-config-override

Weekly Downloads

1

Version

1.2.5

License

MIT

Unpacked Size

41.2 kB

Total Files

71

Last publish

Collaborators

  • charlesstover