jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.2k stars 6.46k forks source link

[Bug]: Issue with Jest Test Coverage in Azure Pipeline: "ENOENT: no such file or directory" #15305

Open mukeshghodela-easternts opened 1 month ago

mukeshghodela-easternts commented 1 month ago

Version

29.7.0

Steps to reproduce

Expected behavior

Actual behavior

An error occurs: Error: ENOENT: no such file or directory, open '/home/vsts/work/1/s/node_modules/@sanity/image-url/src/builder.ts'. This issue only happens when running tests with coverage.

Additional context

This issue occurs specifically when running tests with coverage enabled in the Azure Pipeline. The error indicates that Jest is attempting to access the source code of the @sanity/image-url package, which should not be necessary for running tests. This behavior is inconsistent with local test runs, where coverage works without issues. It appears to be related to how the Azure environment handles module resolution or coverage collection.

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  Binaries:
    Node: 18.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.0.6 - ~\AppData\Roaming\npm\pnpm.CMD
  npmPackages:
    jest: ^29.7.0 => 29.7.0
github-actions[bot] commented 1 week ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.