Is it possible to show only the summary of a Mocha test suite in the cli report?
Asked Answered
K

1

6

I run my Mocha tests using the following command:

mocha --compilers js:babel-core/register --recursive --colors --watch

The tests work perfectly, but I am not satisfied with the look of the report in the terminal. For a TDD approach I want to write a lot of tests beforehand that all fail, then make start to write the code that makes them pass.

Right now I get the summary of test results on top, then details for every failed test. I want to see the summary at the end, so I don't have to scroll through the terminal every time I check.

How can I move the summary to the bottom? Can I make a separate test command that ONLY shows the summary?

Thanks for any help

Kadiyevka answered 19/11, 2016 at 13:9 Comment(0)
R
6

What you are seeing is the default reporter spec:

Spec reporter screenshot

This is the default reporter. The “spec” reporter outputs a hierarchical view nested just as the test cases are.

If you have lots of tests the output from the spec reporter can easily fill several pages in your console. What you probably want is a more compact test reporter, like dot-matrix

Dot matrix reporter screenshot

The dot matrix (or “dot”) reporter is simply a series of characters which represent test cases. Failures highlight in red exclamation marks (!), pending tests with a blue comma (,), and slow tests as yellow. Good if you prefer minimal output.

You can call the dot matrix reporter with mocha -R dot

Rudderpost answered 2/5, 2017 at 7:13 Comment(1)
Had it figured out by now, but this is exactly what I wanted so thank you!Kadiyevka

© 2022 - 2024 — McMap. All rights reserved.