-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Exit storybook build non-zero on stats errors (e.g. errors in the transpilation pipeline) #1372
Conversation
Currently, storybook does not exit non-zero when there are errors in the pipeline, e.g. we are using TypeScript with `ts-loader` and a type error that fails tsc does not make storybook exit non-zero even though the transpilation failed.
app/react/src/server/build.js
Outdated
return logger.error(e); | ||
}); | ||
} | ||
if (err || stats.hasErrors()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(err || stats.hasErrors()) {
const errors = err ? [err] : stats.toJson().errors
errors.forEach(...)
process.exit(1)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would not print the stats errors if there is a "normal" error - is that deliberate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, main point is that i think it should just be a single if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, changes in 9c57ae0
Codecov Report
@@ Coverage Diff @@
## master #1372 +/- ##
==========================================
- Coverage 14.1% 14.09% -0.01%
==========================================
Files 201 201
Lines 4609 4611 +2
Branches 502 583 +81
==========================================
Hits 650 650
+ Misses 3521 3463 -58
- Partials 438 498 +60
Continue to review full report at Codecov.
|
Just tested
|
@mrmartineau it could have been a hidden issue before, if the error was swallowed and never printed and also not changed the exit code. The changes in this PR would pick up such a hidden problem. |
Currently, storybook does not exit non-zero when there are errors in the pipeline, e.g. we are using TypeScript with
ts-loader
and a type error that fails tsc does not make storybook exit non-zero even though the transpilation failed.Issue:
What I did
Run
build-storybook
with a "broken" typescript source.How to test
Any transpiler (for example typescript) producing an error will still not make storybook exit non-zero.