Skip to content
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

feat: add mocha failure messages to console output #5984

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

maribethb
Copy link
Contributor

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

#5622

Proposed Changes

Reports mocha failures in console output when running npm run test and node tests/mocha/run_mocha_tests_in_browser.js (but not when running npm 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:

============Blockly Mocha Test Summary=================
0 tests failed
============Blockly Mocha Test Summary=================

1+ failures shows:

============Blockly Mocha Test Failures================
"Abstract Fields Serialization Save JSO No implementations" failed: expected 'test value' to not equal 'test value'
"Tooltip Custom Tooltip Custom function is called" failed: Expected custom tooltip function to have been called: expected true to be false
============Blockly Mocha Test Summary=================
2 tests failed
============Blockly Mocha Test Summary=================

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)

============Blockly Mocha Test Failures================
There is at least one test failure, but no messages reported. Mocha may be failing because no tests are being run.
============Blockly Mocha Test Summary=================
1 tests failed
============Blockly Mocha Test Summary=================

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.

@maribethb maribethb requested a review from a team as a code owner March 5, 2022 03:09
@maribethb maribethb requested a review from NeilFraser March 5, 2022 03:09
@maribethb maribethb merged commit 7d250fa into google:develop Mar 8, 2022
@maribethb maribethb deleted the mocha-report branch April 1, 2022 18:35
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