Comments (1)
** Disclaimer** This information might be inaccurate, due to it being generated automatically
- In
addons/coverage/src/index.ts
, register the addon:
import { addons, types } from '@storybook/addons';
import { ADDON_ID, PANEL_ID } from './constants';
import { CoveragePanel } from './CoveragePanel';
addons.register(ADDON_ID, () => {
addons.add(PANEL_ID, {
type: types.PANEL,
title: 'Coverage',
render: CoveragePanel,
});
});
- Create
addons/coverage/src/CoveragePanel.tsx
for the UI:
import React from 'react';
import { useParameter } from '@storybook/api';
import { PARAM_KEY } from './constants';
export const CoveragePanel: React.FC = () => {
const coverageData = useParameter(PARAM_KEY, null);
return (
<div>
{coverageData ? (
<pre>{JSON.stringify(coverageData, null, 2)}</pre>
) : (
<p>No coverage data available</p>
)}
</div>
);
};
- Update
addons/coverage/src/constants.ts
:
export const ADDON_ID = 'storybook/coverage';
export const PANEL_ID = `${ADDON_ID}/panel`;
export const PARAM_KEY = 'coverage';
- Modify
addons/coverage/src/preview.ts
to set coverage data:
import { addons } from '@storybook/addons';
import { PARAM_KEY } from './constants';
addons.setConfig({
[PARAM_KEY]: window.__coverage__ || null,
});
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
from storybook.
Related Issues (20)
- [Bug]: Storybook doesn't work with `Yarn 4 (nodeLinker: pnpm)`, `Vue 3`, `Vite 5`, `Storybook 8` HOT 1
- [Bug]: Onboarding fails when PascalCase story is created HOT 1
- Vitest: Create "Component Coverage" per story file HOT 1
- Vitest|Storybook: Create communication channel to gather coverage information HOT 1
- File Selection: Show coverage for all relevant files HOT 1
- [Bug]: Boolean controls break when attributes names use hyphens(-) in Lit HOT 1
- [Bug]: error when starting `storybook` using `postcss-url` plugin to inline assets HOT 1
- [Bug]: Cannot access Next router in custom container when using NextJS preset with Docs add-on
- [Bug]: Docs broken with high CPU usage HOT 3
- [Bug]: Docs page menu item cannot be clicked; the page does not respond. HOT 4
- [Bug]: Docs page renders the Toast multiple times
- [Bug]: Addon build fails due to missing `@storybook/manager/globals` on 8.2.x
- [Bug]: links on docs page for config point to 404 HOT 2
- [Bug]: @storybook/addon-coverage does not work with CRA (Create React App) setup HOT 1
- [Documentation]: Angular - The documentation for handing event emitters is non existant. HOT 2
- [Bug]: Seeing warning about CJS even though my project is ESM HOT 3
- [Bug]: themes.normal not working for docs pages HOT 6
- Blog Post: Highlight the feature
- [Bug]: Addon build fails due to missing @storybook/manager/globals on 8.2.5 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook.