Skip to content

Commit

Permalink
fix test-coverage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraKumo001 committed Jan 26, 2023
1 parent bbc8f9b commit 56e4d76
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions docs/writing-tests/test-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Coverage tests examine the instrumented code against a set of industry-accepted

## Code instrumentation with the coverage addon

Storybook provides an official [test coverage addon](https://storybook.js.org/addons/@storybook/addon-coverage). Powered by [Instanbul](https://istanbul.js.org/), which allows out-of-the-box code instrumentation for the most commonly used frameworks and builders in the JavaScript ecosystem.
Storybook provides an official [test coverage addon](https://storybook.js.org/addons/@storybook/addon-coverage). Powered by [Istanbul](https://istanbul.js.org/), which allows out-of-the-box code instrumentation for the most commonly used frameworks and builders in the JavaScript ecosystem.

### Set up the coverage addon

Expand Down Expand Up @@ -90,22 +90,22 @@ By default, the [`@storybook/addon-coverage`](https://storybook.js.org/addons/@s

<!-- prettier-ignore-end -->

| Option | Description | Plugin |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `cwd` | Defines the current working directory <br/>`options: { instanbul: { cwd: process.cwd(),}}` | Babel, Vite |
| `include` | Select the files to collect coverage <br/>`options: { instanbul: { include: ['**/stories/**'],}}` | Babel, Vite |
| `exclude` | Select the files to exclude from coverage <br/>`options: { instanbul: { exclude: ['**/stories/**'],}}` | Babel, Vite |
| `extension` | Sets additional file extensions for coverage <br/>`options: { instanbul: { extension: ['.js', '.cjs', '.mjs'],}}` | Babel, Vite |
| `nycrcPath` | Defines the relative path for the existing nyc configuration file <br/>`options: { instanbul: { nycrcPath: '../nyc.config.js',}}` | Babel, Vite |
| `excludeNodeModules` | Disables `node_modules` directory introspection <br/>`options: { instanbul: { excludeNodeModules:false,}}` | Babel |
| `ignoreClassMethods` | Configures a set of method names to ignore from being collected <br/>`options: { instanbul: { ignoreClassMethods: ['example', 'myMethod'],}}` | Babel |
| `useInlineSourceMaps` | Enables coverage collection on source maps <br/>`options: { instanbul: { useInlineSourceMaps: false,}}` | Babel |
| `inputSourceMap` | Sets the value to store the source map.<br/> Useful for instrumenting code programmatically <br/>`options: { instanbul: { inputSourceMap: sourceMap,}}` | Babel |
| `onCover` | Hook to monitor coverage collection for all tests <br/>`options: { instanbul: { onCover: (fileName, fileCoverage) => {},}}` | Babel |
| `requireEnv` | Overrides the `VITE_COVERAGE` environment variable's value by granting access to the `env` variables <br/>`options: { instanbul: { requireEnv: true,}}` | Vite |
| `cypress` | Replaces the `VITE_COVERAGE` environment variable with `CYPRESS_COVERAGE`. <br/>Requires Cypress <br/>`options: { instanbul: { cypress: true,}}` | Vite |
| `checkProd` | Configures the plugin to skip instrumentation in production environments <br/>`options: { instanbul: { checkProd: true,}}` | Vite |
| `forceBuildInstrument` | Configures the plugin to add instrumentation in build mode <br/>`options: { instanbul: { forceBuildInstrument: true,}}` | Vite |
| Option | Description | Plugin |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| `cwd` | Defines the current working directory <br/>`options: { istanbul: { cwd: process.cwd(),}}` | Babel, Vite |
| `include` | Select the files to collect coverage <br/>`options: { istanbul: { include: ['**/stories/**'],}}` | Babel, Vite |
| `exclude` | Select the files to exclude from coverage <br/>`options: { istanbul: { exclude: ['**/stories/**'],}}` | Babel, Vite |
| `extension` | Sets additional file extensions for coverage <br/>`options: { istanbul: { extension: ['.js', '.cjs', '.mjs'],}}` | Babel, Vite |
| `nycrcPath` | Defines the relative path for the existing nyc configuration file <br/>`options: { istanbul: { nycrcPath: '../nyc.config.js',}}` | Babel, Vite |
| `excludeNodeModules` | Disables `node_modules` directory introspection <br/>`options: { istanbul: { excludeNodeModules:false,}}` | Babel |
| `ignoreClassMethods` | Configures a set of method names to ignore from being collected <br/>`options: { istanbul: { ignoreClassMethods: ['example', 'myMethod'],}}` | Babel |
| `useInlineSourceMaps` | Enables coverage collection on source maps <br/>`options: { istanbul: { useInlineSourceMaps: false,}}` | Babel |
| `inputSourceMap` | Sets the value to store the source map.<br/> Useful for instrumenting code programmatically <br/>`options: { istanbul: { inputSourceMap: sourceMap,}}` | Babel |
| `onCover` | Hook to monitor coverage collection for all tests <br/>`options: { istanbul: { onCover: (fileName, fileCoverage) => {},}}` | Babel |
| `requireEnv` | Overrides the `VITE_COVERAGE` environment variable's value by granting access to the `env` variables <br/>`options: { istanbul: { requireEnv: true,}}` | Vite |
| `cypress` | Replaces the `VITE_COVERAGE` environment variable with `CYPRESS_COVERAGE`. <br/>Requires Cypress <br/>`options: { istanbul: { cypress: true,}}` | Vite |
| `checkProd` | Configures the plugin to skip instrumentation in production environments <br/>`options: { istanbul: { checkProd: true,}}` | Vite |
| `forceBuildInstrument` | Configures the plugin to add instrumentation in build mode <br/>`options: { istanbul: { forceBuildInstrument: true,}}` | Vite |

## What about other coverage reporting tools?

Expand Down

0 comments on commit 56e4d76

Please sign in to comment.