Skip to content

fix (tests): Suppress console output in tests #181

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 2 commits into from
Oct 30, 2018

Conversation

mjc1283
Copy link
Contributor

@mjc1283 mjc1283 commented Oct 29, 2018

Summary

Inspired by #147, this updates tests to prevent real console output that makes results hard to read.

  • In general, we can create loggers with logToConsole: false to disable real output. For tests that don’t assert log calls, I used this.
  • If a test was previously stubbing only to prevent real output, I removed the stub and used logToConsole: false instead.
  • Some tests were stubbing both to assert log calls and to prevent real output. I mostly left these alone.
  • As pointed out in fix(test): Suppress logs when NODE_ENV=test #147, real output was sometimes still happening because log was called before sinon.stub. For these, I added logToConsole: false.
  • The top-level entry points (index.node.js and index.browser.js) construct loggers internally. To prevent real output in these cases, I stubbed createLogger.

Test plan

Run tests and verify that there is no unwanted real log output

@mjc1283 mjc1283 requested a review from mikeproeng37 October 29, 2018 23:03
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 97.258% when pulling 1d9673d on mcarroll/clean-test-log into 4d3d40c on master.

@coveralls
Copy link

coveralls commented Oct 29, 2018

Coverage Status

Coverage decreased (-0.2%) to 97.258% when pulling 1ddd9e0 on mcarroll/clean-test-log into 4d3d40c 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.

lgtm

@mjc1283 mjc1283 merged commit 615d9da into master Oct 30, 2018
@mjc1283 mjc1283 deleted the mcarroll/clean-test-log branch October 30, 2018 22:52
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.

3 participants