Skip to content

@nx/vite:test hangs after dependency upgrade, if multiple spec files #22006

Closed

Description

Current Behavior

On running nx test foo the vite test executor hangs, and you have to either CTRL+C to get out or wait for a "fetch timeout" error. I've included a reproducible shell script below for showing the problem and how it only occurs when there is more than one test file

After running the script below, the only way to fix is to manually downgrade the vite version used by vitest and vite-node, by editing the pnpm-lock.yaml file, replace all instances of vite: 5.1.4(@types/node@20.11.20) with vite: 5.0.12(@types/node@20.11.20) then run pnpm i - the test will begin working again

Expected Behavior

The test should complete as expected

GitHub Repo

No response

Steps to Reproduce

# vitest problems

project_name="zzz"

npx create-nx-workspace@latest $project_name \
  --workspaceType integrated --ci skip --preset ts --packageManager pnpm

cd $project_name

nx g lib foo --bundler=none --unit-test-runner=vitest

nx test foo # 1 spec file - works
cp foo/src/lib/foo.spec.ts foo/src/lib/foo2.spec.ts
nx test foo # 2 spec files - works

pnpm update --latest

nx test foo # 2 spec files - fails
rm foo/src/lib/foo2.spec.ts
nx test foo # 1 spec files - works

pnpm i -D vite@5.0.12
cp foo/src/lib/foo.spec.ts foo/src/lib/foo2.spec.ts
nx test foo # 2 spec files - fails

Nx Report

Node   : 21.6.2
OS     : darwin-arm64
pnpm   : 8.15.3

nx (global)        : 18.0.4
nx                 : 18.0.5
@nx/js             : 18.0.5
@nx/eslint         : 18.0.5
@nx/workspace      : 18.0.5
@nx/eslint-plugin  : 18.0.5
@nx/vite           : 18.0.5
@nx/web            : 18.0.5
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions