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

CLI: handle promise rejections #1826

Merged
merged 1 commit into from
Sep 9, 2017
Merged

Conversation

Hypnosphi
Copy link
Member

Issue: promise rejections are left unhandled, which leads to node warning and false-negative tests

What I did

How to test

  • add this line to const end handler in generate.js:
    throw new Error("OOPS");
    
  • run CLI test: yarn test --cli

Before:

 • Adding storybook support to your "Meteor" app. ✓
(node:48487) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: OOPS
(node:48487) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

 getstorybook - the simplest way to add a storybook to your project. 

 • Detecting project type. ✓
 • Adding storybook support to your "React" app

Note that tests keep running without error

After:

 • Adding storybook support to your "Meteor" app. ✓
Error: OOPS
    at end (/Users/jetbrains/IdeaProjects/storybook/lib/cli/bin/generate.js:50:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! Test failed.  See above for more details.
error Command failed with exit code 1.

@codecov
Copy link

codecov bot commented Sep 9, 2017

Codecov Report

Merging #1826 into release/3.3 will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release/3.3    #1826      +/-   ##
===============================================
- Coverage        22.46%   22.45%   -0.02%     
===============================================
  Files              321      321              
  Lines             6276     6279       +3     
  Branches           787      793       +6     
===============================================
  Hits              1410     1410              
+ Misses            4275     4261      -14     
- Partials           591      608      +17
Impacted Files Coverage Δ
lib/cli/bin/generate.js 0% <0%> (ø) ⬆️
addons/info/src/components/Node.js 39.43% <0%> (ø) ⬆️
lib/ui/src/modules/api/actions/api.js 50.47% <0%> (ø) ⬆️
addons/knobs/src/react/WrapStory.js 12% <0%> (ø) ⬆️
.../src/modules/ui/components/stories_panel/header.js 29.62% <0%> (ø) ⬆️
app/react/src/client/preview/element_check.js 41.17% <0%> (ø) ⬆️
addons/info/src/components/types/OneOfType.js 11.11% <0%> (ø) ⬆️
lib/ui/src/modules/ui/configs/handle_keyevents.js 33.33% <0%> (ø) ⬆️
lib/codemod/src/transforms/update-addon-info.js 51.16% <0%> (ø) ⬆️
addons/info/src/components/markdown/htags.js 30% <0%> (ø) ⬆️
... and 30 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e78851...40716af. Read the comment docs.

@Hypnosphi Hypnosphi added cli maintenance User-facing maintenance tasks labels Sep 9, 2017
@ndelangen ndelangen merged commit 7cdb906 into release/3.3 Sep 9, 2017
@ndelangen ndelangen deleted the cli-promise-rejections branch September 9, 2017 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants