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

Verbose test results #370

Merged
merged 12 commits into from
May 20, 2015
Merged

Conversation

PhilVargas
Copy link
Contributor

Add a --verbose config flag to pretty print the test suite individually
Relates to issue #4 and takes into account some of the suggestions from pull #92
contributors include myself @PhilVargas and @arcin

called using jest --verbose

example of when the test suite passes:
pass image
example of when the test suite fails:
fail image

PhilVargas and others added 8 commits May 13, 2015 14:02
Creates an object that keeps track of an individual test's ancestry.
This is done in order to maintain the correct relationship between
`describe` blocks and their child `it` blocks.
Prepare a logger to correctly format a verbose response. Traverse test
heirarchy to preserve ancestry titles when logging test titles.
Use an instance of `VerboseLogger` to log detailed information about
tests when a user adds `--verbose` as a flag.
On each test run, add any failure messages to aggregatedResults,
and suppress the default Pass/Fail messages

On test run completion, print to the console any error messages
that have accrued in aggregatedResults
The verbose output is accomplished using recursion to construct and traverse a
tree. This is a simple way of keeping track of a given test title's (it block)
ancestry and level of indentation. Both necessary for correct formatting.
@DmitrySoshnikov
Copy link
Contributor

This looks really good. We can probably change recursion (in building and reporting the tree) with a loop for a better performance, although, if it's not noticeable performance win, we can keep recursion since it's cleaner.

For the visual output, you may want consider instead of coloring the whole title as green, to use just a green checkmark (or red cross in case of failure) -- you can check how Mocha framework displays it.

Change test result display to a check or x on pass/fail, with a gray
colored test title

If no highlight is present replace check and x with PASS and FAIL
Move formatMsg to the utils file and make it available for export.

Modify the _formatMsg functions found in the DefaultTestReporter,
JasmineReporter, and VerboseLogger to use the formatMsg mixin
@PhilVargas
Copy link
Contributor Author

Thanks for the feedback @DmitrySoshnikov ! Went through and linted all the files, moved the _formatMsg function into utils so it can be exported out to the various reporters, and changed the style of the verbose output to more resemble mocha instead of rspec. Screenshots of the updated output are below:
failing test
failing test

passing test
passing test

@DmitrySoshnikov
Copy link
Contributor

OK, this looks perfect, thanks for the contribution!

(worth also measuring the time with verbose and standard outputs for analysis)

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants