Core: Handle BROWSER=none correctly and improve error messages#33730
Merged
valentinpalkovic merged 1 commit intostorybookjs:nextfrom Feb 3, 2026
Merged
Conversation
Fixes storybookjs#24191 When BROWSER environment variable is set to 'none', Storybook should not attempt to open a browser. This fix: 1. Properly handles the return value of openBrowser() - when it returns false (BROWSER=none), we skip the fallback open() call entirely 2. Improves error messages when browser opening fails, showing the BROWSER env value if set to help users diagnose issues Before this fix, even when openBrowser() returned false for BROWSER=none, the code might still attempt the fallback browser opening. The fix also helps users who set invalid BROWSER values by including the current BROWSER value in the error message, making it easier to diagnose issues like typos.
Contributor
📝 WalkthroughWalkthroughThis PR modifies the browser opening utility to handle cases where browser launching is explicitly disabled (BROWSER=none), adding an early return when the browser cannot open. It also corrects a variable name typo and improves error messages with environment variable guidance. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
valentinpalkovic
approved these changes
Feb 3, 2026
This was referenced Feb 3, 2026
Merged
1 task
This was referenced Mar 18, 2026
Merged
1 task
This was referenced Mar 18, 2026
This was referenced Mar 18, 2026
1 task
This was referenced Mar 18, 2026
This was referenced Mar 31, 2026
1 task
This was referenced Apr 2, 2026
1 task
This was referenced Apr 5, 2026
1 task
This was referenced Apr 6, 2026
1 task
This was referenced Apr 8, 2026
Closed
8 tasks
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #24191
When the
BROWSERenvironment variable is set tonone, Storybook should not attempt to open a browser. This fix ensures the behavior is correct and improves error messages.Changes
Properly handle openBrowser() return value: When
openBrowser()returnsfalse(indicatingBROWSER=nonewas set intentionally), we now skip the fallbackopen()call entirely.Improved error messages: When browser opening fails, the error message now includes the current
BROWSERenvironment variable value if set, helping users diagnose issues like typos or invalid values.Before this fix
Even when
openBrowser()returnedfalseforBROWSER=none, the code might still attempt the fallback browser opening with theopenpackage.After this fix
Testing
BROWSER=none- no browser opens, no errorSummary by CodeRabbit
BROWSER=noneand--cienvironment flags to prevent automatic browser opening.✏️ Tip: You can customize this high-level summary in your review settings.