Socket
Book a DemoInstallSign in
Socket

@storybook/addon-coverage

Package Overview
Dependencies
Maintainers
29
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-coverage

Tools to support code coverage in Storybook

0.0.2-canary.2.726749d.0
Source
npmnpm
Version published
Weekly downloads
245K
-4.82%
Maintainers
29
Weekly downloads
 
Created
Source

Storybook Addon Coverage

Tools to support code coverage in Storybook and the Storybook test runner

Installation

Install this addon by adding the @storybook/addon-coverage dependency:

yarn add -D @storybook/addon-coverage

And by registering it in your .storybook/main.js:

module.exports = {
  addons: ['@storybook/addon-coverage'],
};

Configuring the addon

This addon instruments your code by using babel-plugin-istanbul. It provides some default configuration, but if you want to add yours, you can do so by setting the options in your .storybook/main.js:

module.exports = {
  addons: [
    { 
      name: '@storybook/addon-coverage',
      options: {
        istanbul: {
          include: ["**/stories/**"]
        }
      }  
    }
  ],
};

The available options are as follows:

Option nameDescriptionTypeDefault
cwdSet the working directoryString['**']
includeSee here for more infoArray<String>['**']
excludeSee here for more infoArray<String>list
extensionList of extensions that nyc should attempt to handle in addition to .jsArray<String>['.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx', '.vue', '.svelte]

Development scripts

  • yarn start runs babel in watch mode and starts Storybook
  • yarn build build and package your addon code

License

MIT

Keywords

storybook-addons

FAQs

Package last updated on 11 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.