jestjs/jest

[Bug]: watch mode fails when git maintenance runs

Open

#13,869 创建于 2023年2月7日

在 GitHub 查看
 (27 评论) (5 反应) (0 负责人)TypeScript (6,653 fork)batch import
:bug: BugHelp WantedPinnedWindows

仓库指标

Star
 (45,361 star)
PR 合并指标
 (平均合并 11天 22小时) (30 天内合并 11 个 PR)

描述

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

贡献者指南