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

Running test-storybook does not seem to see .stories.mdx files, only .stories.js files. #18741

Closed
KennethSlade opened this issue Jul 19, 2022 Discussed in #18718 · 1 comment

Comments

@KennethSlade
Copy link

KennethSlade commented Jul 19, 2022

Discussed in #18718

Originally posted by KennethSlade July 14, 2022
When I run test-storybook in version 6.5.9, I only see my *.stories.js files get run and pass. I don't see any of my .stories.mdx files, even though stories are specified in main.js as both being valid:

module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
...

Storybook packages from package.json:

    "@storybook/addon-actions": "^6.5.9",
    "@storybook/addon-docs": "^6.5.9",
    "@storybook/addon-essentials": "^6.5.9",
    "@storybook/addon-interactions": "^6.5.9",
    "@storybook/addon-links": "^6.5.9",
    "@storybook/jest": "^0.0.10",
    "@storybook/react": "^6.5.9",
    "@storybook/test-runner": "^0.4.0",
    "@storybook/testing-library": "^0.0.13",
    "@storybook/testing-react": "^1.3.0",

Output looks like:

npm test

> my-storybook@0.5.2 test
> test-storybook --url http://localhost:4000

 PASS   browser: chromium  src/artifacts/xxxxxxx.stories.js
 PASS   browser: chromium  src/artifacts/yyyyyyy.stories.js

Test Suites: 2 passed, 2 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        5.024 s
Ran all test suites.

I have about 10 .stories.mdx files that aren't being picked up. Most of my stories in those files have play added to the Story elements, and the interaction tests work in the browser, which is okay, but I was hoping to see them execute with test-storybook for CI purposes.

Am I missing a configuration option or something or is this a bug?

@KennethSlade
Copy link
Author

KennethSlade commented Jul 19, 2022

I found a workaround here using the buildStoriesJson feature flag in main.js and then running test-storybook with the --stories-json flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant