Thanks to visit codestin.com
Credit goes to github.com

Skip to content

--watch mode re-runs all tests on file change, docs are not clear.Β #10651

@wclr

Description

@wclr

πŸ› Bug Report

Docs state:

Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the --watchAll option instead.

I have two files:
a.test.js with A test suite.
b.test.js with B test suite.

To me, this sounds like if I change file a.test.js then jest only runs test from changed file a.test.js. But Jest reruns all the tests from all two files.

To Reproduce

This is easy to reproduce. I will make a repo if needed. I just want confirmation. That it is not expected behavior. And if it is expected then docs should be updated. And I wonder what is the advice on this issue.

Expected behavior

Run only tests from the changed file.

Link to repl or repo (highly encouraged)

envinfo


  System:
    OS: Windows 10 10.0.19042
    CPU: (6) x64 Intel(R) Core(TM) i5-9600 CPU @ 3.10GHz   
  Binaries:
    Node: 14.4.0 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^26.6.0 => 26.6.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