Skip to content

Changing a file's access time re-runs tests in watch mode #7124

@kumar303

Description

@kumar303

🐛 Bug Report

When running jest --watch, changing a file's access time triggers a test re-run.

To Reproduce

Steps to reproduce the behavior:

  • Start jest --watch
  • Change the access time for a file and nothing else. Example: touch -a src/components/SomeComponent.js

Expected behavior

I don't expect Jest to re-run tests when only the access time changes. I would expect it to re-run tests when the modified time changes or new files are added, etc.

Link to repl or repo (highly encouraged)

Please provide either a repl.it demo or a minimal repository on GitHub.

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS Sierra 10.12.6
    CPU: x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
  Binaries:
    Node: 8.11.4 - ~/.nvm/versions/node/v8.11.4/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.11.4/bin/npm
  npmPackages:
    jest: ^23.1.0 => 23.1.0

The chokidar file watcher always changes access time shortly after a file is modified. I'm not sure why and I'm not sure how to turn it off. Since I use chokidar in a separate shell to run flow as I edit code, this causes my tests to always run twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions