feat: add mocha failure messages to console output #5984
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
#5622
Proposed Changes
Reports mocha failures in console output when running
npm run test
andnode tests/mocha/run_mocha_tests_in_browser.js
(but not when runningnpm run test:mocha:interactive
)Also removed the extra number that was printed before the line saying
x tests failed
Behavior Before Change
Only logged the number of tests that failed.
Behavior After Change
0 failures shows:
1+ failures shows:
With the
failZero
flag set to true (like in #5981) then mocha fails but doesn't provide an error message. so in that case we get (I wrote this message so we can change it if desired)It's not the prettiest thing in the world, but it's probably better than not showing any error messages.
Reason for Changes
Test Coverage
Documentation
Additional Information
I think ultimately the correct thing would be to not use webdriverio at all and just call mocha directly from node. That would require a few changes to our test setup but importantly it's blocked by migrating to es modules (mocha would run each test file directly, and it doesn't understand the
goog.module
syntax. there are probably other ways of working around this but if we're getting off closure modules soon then better just to wait for that). When running from the command line there are lots of build in reporter options that have nicely formatted output.