Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest v16.0.2 exit code is 0 (success) when coverage threshold is not met #1964

Closed
jokeyrhyme opened this issue Oct 21, 2016 · 4 comments
Closed

Comments

@jokeyrhyme
Copy link

Do you want to request a feature or report a bug?

bug

What is the current behavior?

jest ends with a 0 exit code when tests pass but coverage does not meet the threshold

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

package.json excerpt:

{
  "jest": {
    "collectCoverage": true,
    "coverageThreshold": {
      "global": {
        "lines": 90
      }
    }
  }
}

Running jest, I see in red text:

Jest: Coverage for lines (7.69%) does not meet global threshold (90%)

But, echo $? still returns 0.

What is the expected behavior?

The exit code should not be 0.

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

jest version = 16.0.2
test framework = jasmine2
config = {
  "collectCoverage": true,
  "coverageThreshold": {
    "global": {
      "lines": 90
    }
  },
  "rootDir": "/Users/ron/GitHub/jokeyrhyme/boxen-notify.js",
  "name": "-Users-ron-GitHub-jokeyrhyme-boxen-notify.js",
  "setupFiles": [],
  "testRunner": "/Users/ron/GitHub/jokeyrhyme/boxen-notify.js/node_modules/jest-jasmine2/build/index.js",
  "scriptPreprocessor": "/Users/ron/GitHub/jokeyrhyme/boxen-notify.js/node_modules/babel-jest/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/var/folders/mx/_pq4c8yx2nl1h05ht_w2m1y40000gn/T/jest",
  "clearMocks": false,
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "globals": {},
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "moduleNameMapper": {},
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "preprocessorIgnorePatterns": [
    "/node_modules/"
  ],
  "resetModules": false,
  "testEnvironment": "jest-environment-jsdom",
  "testPathDirs": [
    "/Users/ron/GitHub/jokeyrhyme/boxen-notify.js"
  ],
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": true,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}

Node.js 6.9.1
npm 3.10.8
macOS Sierra

@lazywithclass
Copy link
Contributor

I've had a look at this and had a go at a possible solution: #1974

@cpojer
Copy link
Member

cpojer commented Oct 24, 2016

This will be fixed in #1974.

@cpojer cpojer closed this as completed Oct 24, 2016
@jokeyrhyme
Copy link
Author

Yay, thanks!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants