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

Error when running tests after clearing jest cache: NX ENOENT: no such file or directory, open when #23170

Closed
1 of 4 tasks
faboulaws opened this issue May 3, 2024 · 2 comments

Comments

@faboulaws
Copy link

Current Behavior

Original issue: Tests are failing with typescript compilation error. However, when the test file is updated without making any actual change, for example adding space, the tests are passing. This is strange since nothing has changed. I assume that this is a caching issue.

My Solution:

  • run nx test <package name > --clearCache to clear jest cache
  • then run nx test <package name>

Problem
The second command sometimes returns the error below:

nx run <package name>:test
 >  NX   ENOENT: no such file or directory, open '/private/var/folders/g1/h0b_zyq97dg3x0kdd57d143m0000gp/T/jest_dy/haste-map-b9ed7ddce28316ef82e5e0fdc3d5b1de-4ff5fed0616f9bbb9c6932e0112e39a1-14a3afd6051f0a3420bd79c4ec57d6ea'

Expected Behavior

There should be no error when running tests after clearing jest cache.

GitHub Repo

No response

Steps to Reproduce

nx test --clearCache
nx test

Will hopefully soon create repo with code to reproduce. However, I assume any project with Jest and Typescript may cause this issue.

Nx Report

Node   : 21.2.0
   OS     : darwin-arm64
   npm    : 10.2.3
   
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/esbuild        : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/node           : 17.2.8
   @nx/plugin         : 17.2.8
   @nrwl/tao          : 17.2.8
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @nx-go/nx-go : 2.8.0

Failure Logs

nx run <package name>
> NX   ENOENT: no such file or directory, open '/private/var/folders/g1/h0b_zyq97dg3x0kdd57d143m0000gp/T/jest_dy/haste-map-b9ed7ddce28316ef82e5e0fdc3d5b1de-4ff5fed0616f9bbb9c6932e0112e39a1-14a3afd6051f0a3420bd79c4ec57d6ea

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@faboulaws
Copy link
Author

Turned out that there is not issue with nx. The pre-commit hook tool I am using is running both commands in parallel.

Copy link

github-actions bot commented Jun 3, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant