-
Notifications
You must be signed in to change notification settings - Fork 5.7k
add sinon-bluebird to make promises in tests a bit cleaner #3000
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
add sinon-bluebird to make promises in tests a bit cleaner #3000
Conversation
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.
Great addition @dougmoscrop 👍
Makes the whole test code a lot easier to read.
Just saw one require (added a comment about it) which might be removed if not needed. Otherwise it's GTM from my side!
Edit: Just tested it w/o this require, which works. Pushed an update to this branch which removes it.
| const Package = require('../index'); | ||
| const Serverless = require('../../../../lib/Serverless'); | ||
|
|
||
| require('sinon-bluebird'); |
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.
Why is sinon-bluebird required here?
|
Thanks, yeah that was my bad. |
|
No worries! Thanks for the PR @dougmoscrop 💯 |
|
Fixed conflicts |
|
Fixed conflicts / rebased - cc @pmuens again :D |
|
Thanks @dougmoscrop 👍 /cc @eahefnawy Edit: We might want to do a follow-up PR because other tests have been written which might still use the old approach... |
pmuens
left a comment
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.
Just pushed a quick update so that all the recently added tests also use sinon-bluebird. Will merge after the tests pass.
Thanks for the addition @dougmoscrop 👍 💯
What did you implement:
Closes #2115
The promise rejections were causing fake 'unhandled rejection' messages to print during the tests. As the related issue says, there's nothing wrong, but this fixes it so that the messages do not get displayed.
How did you implement it:
Using
sinon-bluebird.How can we verify it:
npm test- only affects unit tests.Todos:
Is this ready for review?: YES
Is it a breaking change?: NO