storybookjs / test-runner

🚕 Turn stories into executable tests
https://storybook.js.org/docs/writing-tests/interaction-testing
MIT License
231 stars 72 forks source link

[question] plans to support running tests through jest's CLI #357

Open GeorgeTaveras1231 opened 1 year ago

GeorgeTaveras1231 commented 1 year ago

As an observer it seems it would be doable (and beneficial) to allow users to run the storybook tests directly through Jest. My thinking is you can expose a jest preset that configures jest to search for .story files, transform them to spec files (via some jest transform, also add a setupFile that spins up playwright. (I imagine this is what this library does under the hood - among other things).

The benefit of this would be for users that are already using Jest and have it integrated into their pipelines, it would be much easier to adopt as they will have less changes to make. It will also be good to give the option to run all tests through a single command. This will have some ergonomic benefit of improving feedback loop, and the ability to more easily parallelize all tests (including tests from other jest runners).

Anyways just curious and sharing my ideas!

kasperpeulen commented 11 months ago

Yes, that is possible, here is an example! https://github.com/kasperpeulen/storybook-remix/blob/main/jest-storybook.config.ts