Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mukeshghodela-easternts opened this issue Sep 16, 2024 · 0 comments

Comments

@mukeshghodela-easternts
Copy link

mukeshghodela-easternts commented Sep 16, 2024

Version

29.7.0

Steps to reproduce

  • Set up an Azure Pipeline for a Next.js project that uses the @sanity/image-url package.
  • Ensure that the pipeline includes a step to run tests with coverage.
  • Trigger the pipeline to run the tests.

Expected behavior

  • The tests should run successfully with coverage reports generated without any file not found errors.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant