Skip to content

fix (unit tests): Fix event dispatcher missing in unit test #256

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

Merged
merged 4 commits into from
Apr 8, 2019

Conversation

mjc1283
Copy link
Contributor

@mjc1283 mjc1283 commented Apr 8, 2019

Summary

Optimizely was constructed without an event dispatcher, causing an error to be thrown asynchronously. This fixes the test, and updates the npm test command to make it easier to catch such mistakes - adding a listener for 'unhandledRejection' on process that calls process.exit.

Test plan

Run unit tests, verify log output.

Matt Carroll added 2 commits April 8, 2019 13:05
@@ -0,0 +1,7 @@
process.on('unhandledRejection', function(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind adding a comment in this explaining why this is here.

@coveralls
Copy link

coveralls commented Apr 8, 2019

Coverage Status

Coverage remained the same at 97.834% when pulling b12b958 on mcarroll/unhandled-promise-rejection into dd8c502 on master.

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

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

Fix looks good, just a suggestion on placement and also licensing.

@@ -0,0 +1,11 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should move this into the lib dir and further, into the tests dir since this is only used for tests.

Also, please include the license header for this code file :)

Copy link
Contributor

@mikeproeng37 mikeproeng37 left a comment

Choose a reason for hiding this comment

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

lgtm

@mjc1283 mjc1283 merged commit 6bd45de into master Apr 8, 2019
@mjc1283 mjc1283 deleted the mcarroll/unhandled-promise-rejection branch April 8, 2019 21:22
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.

4 participants