Closed njzydark closed 4 weeks ago
Minimal reproduction or any clue please?
Minimal reproduction or any clue please?
I'll check it later today.
options.webpackAddons
, and use with getAbsolutePath
for resolving the addon correct path.import type { StorybookConfig } from 'storybook-react-rsbuild';
import { dirname, join } from 'node:path';
+function getAbsolutePath(value: string): any {
+ return dirname(require.resolve(join(value, 'package.json')));
+}
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
- // '@storybook/addon-coverage',
],
+ webpackAddons: [
+ {
+ name: getAbsolutePath('@storybook/addon-coverage'),
+ options: {
+ istanbul: {
+ include: ['src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
+ exclude: [],
+ },
+ },
+ },
+ ],
framework: {
name: 'storybook-react-rsbuild',
options: {},
},
docs: {
autodocs: 'tag',
},
typescript: {
reactDocgen: 'react-docgen-typescript',
check: true,
},
};
export default config;
- "test-storybook-coverage": "test-storybook -- --coverage"
+ "test-storybook-coverage": "test-storybook --coverage"
When using the @storybook/addon-coverage plugin to obtain code coverage, the output does not include any test files. According to the plugin documentation, it appears to support Webpack or Vite.