Skip to content

Passing --onlyFailures doesn't run failed tests only #6470

Closed
@segrey

Description

@segrey

🐛 Bug Report

Passing --onlyFailures doesn't run failed tests only.

To Reproduce

// __tests__/a.test.js
it('fails', () => {
  expect(true).toBeFalsy();
});
// __tests__/b.test.js
it('passes', () => {
  expect(true).toBeTruthy();
});
// package.json
{
  "dependencies": {
    "jest": "23.1.0"
  }
}
  1. Run "npm install"
  2. Run all tests initially with ./node_modules/jest/bin/jest.js => 1 passed, 1 failed as expected.
  3. Rerun failed tests only with ./node_modules/jest/bin/jest.js --onlyFailures. Unexpectedly, all tests are run again.

Expected behavior

A single failed test is rerun.

Link to repl or repo (highly encouraged)

https://repl.it/@sergey_simonchik/rerun-failed-tests

Run npx envinfo --preset jest

  System:
    OS: Linux 4.8 Linux Mint 18.1 (Sonya)
    CPU: x64 Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
  Binaries:
    Node: 10.4.0 - ~/.nvm/versions/node/v10.4.0/bin/node
    npm: 6.1.0 - ~/.nvm/versions/node/v10.4.0/bin/npm
  npmPackages:
    jest: 23.1.0 => 23.1.0 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions