Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mocha list only skipped tests

I have hundreds of tests in mocha, tens of which are being skipped.

I would like to run the suite, but only listing the skipped ones, so I can address them.

Does anyone know a way to achieve this? There does not seem to be a command line flag

like image 340
captainclam Avatar asked Oct 21 '22 12:10

captainclam


1 Answers

Mocha comes with a built-in JSON reporter. The output JSON lists all the skipped test cases. For example

mocha -R JSON > test-report.json

Here the test-report.json file should have the following structure.

{
    stats: {...},
    tests: [...],
    pending: [...],
    failures: [...],
    passes: [...]
}

The "pending" key should have all the skipped test cases.

like image 138
chinoy Avatar answered Nov 02 '22 13:11

chinoy