Skip to content

add sinon-bluebird to make promises in tests a bit cleaner - #3000

Merged
pmuens merged 4 commits into
serverless:masterfrom
dougmoscrop:rejected_promises_in_tests
Mar 23, 2017
Merged

pmuens merged 4 commits into
serverless:masterfrom
dougmoscrop:rejected_promises_in_tests

Conversation

@dougmoscrop

Copy link
Copy Markdown
Contributor

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:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config/commands/resources
  • Enable "Allow edits from maintainers" for this PR
  • Change ready for review message below

Is this ready for review?: YES
Is it a breaking change?: NO

@pmuens pmuens left a comment •

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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?

@dougmoscrop

Copy link
Copy Markdown
Contributor Author

Thanks, yeah that was my bad.

@pmuens

pmuens commented Dec 22, 2016

Copy link
Copy Markdown
Contributor

No worries! Thanks for the PR @dougmoscrop 💯

@dougmoscrop

Copy link
Copy Markdown
Contributor Author

Fixed conflicts

@dougmoscrop

Copy link
Copy Markdown
Contributor Author

Fixed conflicts / rebased - cc @pmuens again :D

@pmuens

pmuens commented Feb 9, 2017 •

Copy link
Copy Markdown
Contributor

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 pmuens left a comment

Copy link
Copy Markdown
Contributor

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 👍 💯

@pmuens pmuens added this to the 1.10 milestone Mar 23, 2017
@pmuens
pmuens merged commit 247132c into serverless:master Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some tests return a reject but won't break the overall tests

2 participants