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

Running vitest tests in parallel fails sometimes #21775

Closed
1 of 4 tasks
Maxim-Mazurok opened this issue Feb 12, 2024 · 2 comments · Fixed by #23330
Closed
1 of 4 tasks

Running vitest tests in parallel fails sometimes #21775

Maxim-Mazurok opened this issue Feb 12, 2024 · 2 comments · Fixed by #23330
Assignees
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@Maxim-Mazurok
Copy link

Current Behavior

Getting this sometimes:

>  NX   Running target test for 23 projects
    ×  nx run math:test
       >  NX   ENOTEMPTY: directory not empty, rmdir 'C:\Users\maxim.mazurok\transactions\node_modules\.vitest\deps'

Expected Behavior

no error (like before)

GitHub Repo

No response

Steps to Reproduce

I just have a bunch of vitest projects, and some of them fail sometimes ;( Started after upgrading some deps, was fine before

Nx Report

Node   : 20.10.0
   OS     : win32-x64
   npm    : 10.2.3

   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/linter         : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nx/plugin         : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/vite           : 18.0.4
   typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

@kipprice
Copy link

I was running into this problem as well (same NX version, on mac); I fixed it by updating the cache property within the vitest config to be distinct per library, e.g.

// in [library-name]/vite.config.ts

export default defineConfig({
 ...
  test: {
    cache: {
      dir: '../../node_modules/.vitest/[library-name]',
    },
    ...
  },
} as any);

Would definitely be great to get this part of the vitest config generator though!

@AgentEnder AgentEnder added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Feb 16, 2024
FrozenPandaz pushed a commit that referenced this issue May 13, 2024
…normalize vite cache dir (#23330)

- Update Vitest `cache.dir` to be scoped to each project root to avoid
collisions (same as what's already done for Vite)
- Normalize Vite `cacheDir` to avoid trailing `/.` paths for root
projects
- Fix Remix & Storybook Vite `cacheDir` generation 

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21775
FrozenPandaz pushed a commit that referenced this issue May 13, 2024
…normalize vite cache dir (#23330)

- Update Vitest `cache.dir` to be scoped to each project root to avoid
collisions (same as what's already done for Vite)
- Normalize Vite `cacheDir` to avoid trailing `/.` paths for root
projects
- Fix Remix & Storybook Vite `cacheDir` generation

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #21775

(cherry picked from commit 5fea49a)
Copy link

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 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
4 participants