jestjs/jest

[Bug]: watch mode fails when git maintenance runs

Open

#13.869 aperta il 7 feb 2023

Vedi su GitHub
 (27 commenti) (5 reazioni) (0 assegnatari)TypeScript (6653 fork)batch import
:bug: BugHelp WantedPinnedWindows

Metriche repository

Star
 (45.361 star)
Metriche merge PR
 (Merge medio 11g 22h) (11 PR mergiate in 30 g)

Descrizione

Version

29.4.0

Steps to reproduce

  1. Run your tests with jest --watch and wait until they finish.
  2. In another terminal, run git maintenance run.
  3. The watcher will fail

Expected behavior

Outside process shouldn't kill the watcher.

Actual behavior

Watcher dies immediately with

Error: EPERM: operation not permitted, lstat 'C:\Workspace\my-project\.git\objects\dc\a-very-long-hash'
Emitted 'error' event on NodeWatcher instance at:
    at C:\Workspace\my-project\node_modules\jest-haste-map\build\watchers\NodeWatcher.js:274:14
    at FSReqCallback.oncomplete (node:fs:207:21) {
  errno: -4048,
  code: 'EPERM',
  syscall: 'lstat',
  path: 'C:\\Workspace\\my-project\\.git\\objects\\dc\\a-very-long-hash'
}

I have also seen it point to .git\objects\maintenance.lock.

Additional context

This other issue is where I found the suggestion that it was a background git maintenance command that was causing the conflict, and once I knew that it was easy to reproduce.

Environment

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  Binaries:
    Node: 18.12.1 - ~\AppData\Local\fnm_multishells\30672_1675721836564\node.EXE
    npm: 8.19.2 - ~\AppData\Local\fnm_multishells\30672_1675721836564\npm.CMD
  npmPackages:
    jest: ^29.3.1 => 29.4.0

Guida contributor