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]: --index-json flag not honored when running against a local storybook #538

Open
ronakj opened this issue Feb 11, 2025 · 1 comment · May be fixed by #539
Open

[Bug]: --index-json flag not honored when running against a local storybook #538

ronakj opened this issue Feb 11, 2025 · 1 comment · May be fixed by #539
Labels
bug Something isn't working needs triage

Comments

@ronakj
Copy link

ronakj commented Feb 11, 2025

Describe the bug

This is what the readme mentions

If you are running tests against a local Storybook but for some reason want to run in "index.json mode", you can pass the --index-json flag:

yarn test-storybook --index-json

However the code looks something like this (permalink)

const shouldRunIndexJson = runnerOptions.indexJson !== false && !isLocalStorybookIp;

Which will resolve to false even if the flag is passed. This seems like a bug.

The correct code should be

const shouldRunIndexJson = runnerOptions.indexJson === true || (runnerOptions.indexJson !== false && !isLocalStorybookIp);

To Reproduce

You can easily test this using any locally available pre-built storybook. Start a local server using http-server and try to run tests using --index-json flag. It will not be honored and storybook will try to read the storybook configuration which is not needed in index-json mode.

System

NA. Happening in every system.

Additional context

No response

@ronakj ronakj added bug Something isn't working needs triage labels Feb 11, 2025
@ronakj
Copy link
Author

ronakj commented Feb 11, 2025

I have a fix #539, but feel free to close if this is intentional. I unblocked my org with a patch for an older version of the package (as we are using storybook 7) so I am not in any hurry for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant