-
Notifications
You must be signed in to change notification settings - Fork 2
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:
|
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> <!-- Fixes #0000 --> - Fixes #2080 ## Summary <!-- Please brief explanation of the changes made --> - Storybook 버전을 8로 올리고 breaking change에 대응합니다. ## Details <!-- Please elaborate description of the changes --> - deprecated 된 옵션과 add-on 을 최신화했습니다. 자세한 내용은 커밋에 있는 링크를 참조해주시면 됩니다. - storybook 7.6 버전에서 발생했던 이슈(https://github.com/channel-io/bezier-react/pull/1997#issuecomment-1964040154)가 더이상 발생하지 않는 것을 확인했습니다. - .syncpackrc에 있는 storybook 관련 설정들을 제거합니다. - 8버전에서 제공하는 visual test 는 개발환경에서만 지원한다고 합니다. 개발환경에서 테스트는 좀 해봤는데 빌드하면서 원인을 파악하기 어려운 에러가 떠서 끝가지 동작을 확인할 수는 없었습니다. visual test는 CI에서 확인 가능해서 개발환경에서 지원하는 것의 우선순위는 낮춰도 되지 않을까 하는 생각입니다. -> chromatic 에 문의중 -> 답변 온대로 @mdx-js/loader를 설치해도 안되서 이슈를 확인해봤더니 chromaui/addon-visual-tests#275 chromatic 자체 이슈인 것같습니다. 당분간은 개발 환경에서 visual test 기능은 활용할 수 없을 것 같습니다. - 머지되면 #2308 는 클로즈하면 될것같습니다 ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> - No ## References <!-- Please list any other resources or points the reviewer should be aware of --> - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-7x-to-800
I had the same as issue starter. I had MDX files as well. So i thought read the docs and disable them in Then i runned the command chromatic inside storybook would do when starting the test, for example Very glad to find the same issue and the fix by @JReinhold just to add It now works with this fix: |
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: