javascript - Node.js Istanbul/Mocha Unit Tests not printing details -


i'm trying use istanbul along mocha in node.js run unit tests , generate code coverage reports. i'm using following code run run unit tests , generate code reports.

istanbul cover _mocha -- -r tap 'test/*.test.js' > test.tap; istanbul report clover 

if want run unit tests without code coverage reports can run following.

mocha 

both of these methods work fine. but first method doesn't print console. have no idea unit test running , when it's complete have no idea went wrong. doesn't provide form of error logs or anything. second method prints status of unit test after each test it's easy in console see unit test working on , after tests complete gives details , error logs why failed can start debug. first method doesn't provide of this.

is there anyway generate code coverage reports using istanbul have print details console running mocha prints? if how can achieve this? of tests take little bit run , finish when generating code coverage reports istanbul nice see test it's on , more detail test in real time.

your istanbul command redirects output test.tap, not going see on console:

istanbul cover _mocha -- -r tap 'test/*.test.js' > test.tap; istanbul report clover                                                  ^^^^^^^^^^ 

the test output in test.tap not needed istanbul, remove redirection. if want command continue writing file, use tee command write test output both file , console.


Comments