0

I have a problem with code coverage. This the tests results :

[...]
24 tests passed (24 total in 9 test suites, run time 2.353s)
----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------|
All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|

All reports generated

Process finished with exit code 0

All my tests succeed (count 73 expect). But no cover. I'm just testing normal node code. I use babel-jest, here you have the config in package.json :

"scripts": {
  "test": "jest"
},
"jest": {
  "collectCoverage": true,
  "moduleFileExtensions": [
    "js",
    "json"
  ],
  "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
  "testDirectoryName": "unit",
  "testFileExtensions": [
    "js"
  ],
  "testPathDirs": [
    "<rootDir>/tests/"
  ]
}

Here is my project architecture :

./
|-- app
|   |-- routes
|   |   |-- private
|   |   |-- public
|-- tests
|   |-- unit
|   |   |-- routes
|   |   |   |-- private
|   |   |   |-- public

The tests/unit folder contains the same architecture as app folder as you can see.

Have you an idea about why I don't have any reports ? Thanks in advance !

Anton Sarov
  • 3,712
  • 3
  • 31
  • 48
MathKimRobin
  • 1,268
  • 3
  • 21
  • 52

1 Answers1

0

Finally got answer. It was a bug in Babel. See how to fix this issue there : https://github.com/facebook/jest/issues/632. Fixed in Jest 0.9.0.

MathKimRobin
  • 1,268
  • 3
  • 21
  • 52