Skip to content

Jest 16: coverage empty with collectCoverageFrom #1849

@maiis

Description

@maiis

Hi,

I've just upgraded to jest 16, and since my test coverage are empty.

If I remove the collectCoverageFrom option from the config it seams to works 😳

Apart from that, loving the new features 😍Keep it up 🍻

  "collectCoverageFrom": [
    "<rootDir>/src/main/webapp/scripts/**/*.js"
  ],
----------|----------|----------|----------|----------|----------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |  Unknown |  Unknown |  Unknown |  Unknown |                |
----------|----------|----------|----------|----------|----------------|

=============================== Coverage summary ===============================
Statements   : Unknown% ( 0/0 )
Branches     : Unknown% ( 0/0 )
Functions    : Unknown% ( 0/0 )
Lines        : Unknown% ( 0/0 )
================================================================================
jest version = 16.0.0
test framework = jasmine2
config = {
  "preprocessorIgnorePatterns": [
    "node_modules"
  ],
  "modulePaths": [
    "MYPATH/src/main/webapp/scripts"
  ],
  "moduleNameMapper": [
    [
      "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$",
      "MYPATH/src/test/javascript/file-mock.js"
    ],
    [
      "^.+\\.(css|less)$",
      "MYPATH/src/test/javascript/style-mock.js"
    ]
  ],
  "testPathDirs": [
    "MYPATH/src/main/webapp/scripts"
  ],
  "testResultsProcessor": "MYPATH/node_modules/jest-teamcity-reporter",
  "collectCoverageFrom": [
    "MYPATH/src/main/webapp/scripts/**/*.js"
  ],
  "coverageThreshold": {
    "global": {
      "branches": 95,
      "functions": 95,
      "lines": 95,
      "statements": 95
    }
  },
  "rootDir": "MYPATH",
  "name": "-MYNAME",
  "testRunner": "MYPATH/node_modules/jest-jasmine2/build/index.js",
  "scriptPreprocessor": "MYPATH/node_modules/babel-jest/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/var/folders/x3/142j64696f11fhmkr3f2q6g42rxg89/T/jest",
  "clearMocks": false,
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "resetModules": false,
  "testEnvironment": "jest-environment-jsdom",
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "collectCoverage": true,
  "cache": false,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions