Page MenuHomePhabricator

[node apps using mocha] suppress console.log output from passed unit tests
ClosedPublic

Authored by bytesofman on Apr 5 2023, 22:27.

Details

Summary

T2972

Implement mocha-suppress-logs to suppress console.log statements from passed unit tests (console.log will still print in failed unit tests, which is helpful for developing).

Unit test checking output of logs is removed from alias-server. This diff caused the tests to fail, as would any future diff changing those logs. Best practice not to test output of console.log statements.

While it does seem silly to use yet another module to accomplish this, it is quite small, well-tested, and seems to be the standard way. Plugins to augment performance of engines like mocha or eslint is standard js.

Test Plan

npm test in affected repos, no console.log statements

Diff Detail

Repository
rABC Bitcoin ABC
Branch
mocha-suppress-logs
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23016
Build 45652: Build Diffecash-herald-tests · alias-server-tests
Build 45651: arc lint + arc unit

Event Timeline

matching line break for all .mocharc.js files

Fabien retitled this revision from [node apps using mocha] suppress console.log output from failed unit tests to [node apps using mocha] suppress console.log output from passed unit tests.Apr 6 2023, 07:20
This revision is now accepted and ready to land.Apr 6 2023, 07:26