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

Throw user-friendly error when config file fails to parse as JSON #961

Merged
merged 4 commits into from Mar 29, 2024

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Mar 28, 2024

Fixes chromaui/addon-visual-tests#247

If the Chromatic config file contains invalid JSON, a parse error is thrown in the CLI and printed by the Storybook process. The CLI did already have some handling of this scenario but it wasn't covering every type of JSON syntax error. This update will make it print a nicer error message that includes the config file path so people will know where to look.

📦 Published PR as canary version: 11.3.0--canary.961.8469857131.0

✨ Test out this PR locally via:

npm install chromatic@11.3.0--canary.961.8469857131.0
# or 
yarn add chromatic@11.3.0--canary.961.8469857131.0

Copy link

codacy-production bot commented Mar 28, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.08% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (36aa29a) 8445 6640 78.63%
Head commit (d03f66d) 8445 (+0) 6647 (+7) 78.71% (+0.08%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#961) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

@ghengeveld ghengeveld force-pushed the ghengeveld/247-configuration-file-json-parse-error branch from 3a12043 to 2a11ca3 Compare March 28, 2024 10:18
@ghengeveld ghengeveld added release Auto: Create a `latest` release when merged minor Auto: Increment the minor version when merged labels Mar 28, 2024
Copy link
Member

@thafryer thafryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition! Looks good!

@ghengeveld ghengeveld added this pull request to the merge queue Mar 29, 2024
Merged via the queue into main with commit ed70811 Mar 29, 2024
24 checks passed
@ghengeveld ghengeveld deleted the ghengeveld/247-configuration-file-json-parse-error branch March 29, 2024 10:36
@ghengeveld
Copy link
Member Author

🚀 PR was released in v11.3.0 🚀

@ghengeveld ghengeveld added the released Verdict: This issue/pull request has been released label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Auto: Increment the minor version when merged release Auto: Create a `latest` release when merged released Verdict: This issue/pull request has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration file JSON parse error
2 participants