Vineesh TP
Vineesh TP

Reputation: 7963

Mocha -chai coverage Unknown

Hi all I am trying to get the mocha chai Unit test coverage report.

I am getting the test result passed.

Also generated the coverage as html but, it showing Unknown. Please see below image .

enter image description here

Package.json added the below config in script.

 "scripts": {
    "test": "mocha",
    "test-with-coverage": "nyc --reporter=html mocha"
  },

And using the below command for run the test.

npm run test-with-coverage

Edit: When change report as text , getting the below report in terminal.

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |                   
----------|---------|----------|---------|---------|-------------------

Upvotes: 2

Views: 2874

Answers (1)

Surya
Surya

Reputation: 638

Please try with the below command,

nyc -x \"**/tests/**\" --reporter=cobertura --reporter=html mocha 'your test folder path'

Upvotes: 3

Related Questions