-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a custom MDX file for the AutoDocs Page Template causes a build error when running tests #275
Comments
@brian-patrick-3 thanks so much for filing. this looks like a corner case. in order to speed up Storybook's build process in the visual test addon, we run a "test" build which is like a normal build but with a bunch of features turned off. You can try manually re-enabling them. I'm guessing the MDX one specifically might solve it: https://storybook.js.org/docs/api/main-config-build#testdisablemdxentries |
@shilman Hello, I also encountered the same situation. Even after making Example: import mdx from "./Button.mdx";
const meta = {
title: "Example/Button",
component: Button,
parameters: {
layout: "centered",
docs: {
page: mdx, // this seems to be causing the error
iframeHeight: 100,
},
viewMode: "docs",
},
} satisfies Meta<typeof Button>; Thank you. |
Same issue here. I'm using Svelte, and the error log is a bit different:
I also have the Perhaps as a workaround, is there a way to convince chromatic to do a normal (non-test) build? Also, Sev3 seems a little low for this bug - while it's only an annoyance when it comes to the whole Chromatic service, as it only requires you to manually run |
Possibly related: storybookjs/storybook#25114 |
I think MDX files need // Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';
const config: StorybookConfig = {
framework: '@storybook/your-framework',
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
],
build: {
test: {
disabledAddons: [], // 👈 don't disable any addons
},
},
};
export default config; Possible fixes we could do:
|
Describe the bug
Our project uses a custom DocumentationTemplate.mdx file. The
storybook
andbuild-storybook
commands work with no issue. When I try to run the tests with this addon, a build error is thrown. Removing the custom docs page template allows the tests to run.Error
Template file
preview.js
To reproduce
Here is a link to a branch on our repo where the error can be reproduced: https://github.com/kyndryl-design-system/shidoka-foundation/tree/docs/visual-testing
Environment
Latest versions of storybook and this addon.
The text was updated successfully, but these errors were encountered: