Skip to content

Jest tests return exit code 0 after failing tests #2

@reedflinch

Description

@reedflinch

This makes the package unusable for us in a CI environment - test steps rely on an exit code of 1 to properly signal failure. Perhaps related to winterbe/jest-teamcity-reporter#6?

01:05 PM $ npm --version
3.10.9

01:05 PM $ node --version
v7.2.1

01:06 PM $ yarn --version
0.18.1

"jest": "^18.1.0"

With jest-junit configured as the testResultsProcessor:

$ yarn run test:ci   # translates to 'jest --coverage --runInBand'
Test Suites: 2 failed, 313 passed, 315 total
Tests:       3 failed, 1416 passed, 1419 total
Snapshots:   299 passed, 299 total
Time:        40.853s
Ran all test suites.
✨  Done in 42.16s.

$ echo $?
0

Without "testResultsProcessor": "./node_modules/jest-junit" in my jest config:

$ yarn run test:ci   # translates to 'jest --coverage --runInBand'
Test Suites: 2 failed, 313 passed, 315 total
Tests:       3 failed, 1416 passed, 1419 total
Snapshots:   299 passed, 299 total
Time:        36.84s, estimated 39s
Ran all test suites.
(node:64662) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 43): undefined
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

$ echo $?
1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions