Skip to content
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

[Bug]: Support preview-head.js, middleware.js in @storybook/experimental-addon-test/vitest/plugin #29422

Closed
valentinpalkovic opened this issue Oct 22, 2024 · 2 comments

Comments

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Oct 22, 2024

Describe the bug

Currently, the preview-head.js or the middleware.js file in your .storybook folder doesn't automatically injected into the Vitest environment. Users would have to manually provide scripts in preview-head.js using the browser.testerscripts configuration and to import CSS files manually in their vitest.setup.ts file.

Additionally, the previewHead hook in .storybook/main.js is ignored as well and isn't considered.

Reproduction steps

  1. git clone https://github.com/pkp/ui-library.git
  2. pnpm install
  3. pnpm dlx [email protected] add @storybook/experimental-addon-test
  4. Tests do not consider the scripts set up in .storybook/preview-head.js, which sets up a global.js script and an external jquery script to provide the global $ variable. Additionally, the previewHead preset in .storybook/main.js is ignored as well as the proxying of a URL via .storybook/middleware.js.
@JReinhold
Copy link
Contributor

I don't think we should put effort into supporting middleware.js. I wouldn't expect it to be easy to do, it's an undocumented functionality, and I personally think that users should configure it in their Vite config if they need it.

@yannbf yannbf added this to the 8.x Storybook Test milestone Nov 12, 2024
@JReinhold
Copy link
Contributor

Closing in favor of #29775

@JReinhold JReinhold closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants