Skip to content

Fix vitest test running and debugging for v4 with backwards compatibility#43241

Merged
cole-miller merged 2 commits intozed-industries:mainfrom
freddyfallon:fix-vite4-gutter-issue
Dec 15, 2025
Merged

Fix vitest test running and debugging for v4 with backwards compatibility#43241
cole-miller merged 2 commits intozed-industries:mainfrom
freddyfallon:fix-vite4-gutter-issue

Conversation

@freddyfallon
Copy link

@freddyfallon freddyfallon commented Nov 21, 2025

Summary

This PR updates the vitest test runner integration to use the modern --no-file-parallelism flag instead of the deprecated --poolOptions.forks.minForks=0 and --poolOptions.forks.maxForks=1 flags.

Changes

  • Replaced verbose pool options with --no-file-parallelism flag in both file-level and symbol-level vitest test tasks
  • This change works with vitest v4 while maintaining backwards compatibility with earlier versions (or 3 at least!)

Testing

  • Added test test_vitest_uses_no_file_parallelism_flag that verifies:
    • The --no-file-parallelism flag is present in generated test tasks
    • The deprecated poolOptions flags are not present
  • Manually tested with both vitest v4 and older versions to confirm backwards compatibility
  • All existing tests pass

Impact

This allows Zed users to run and debug vitest tests in projects using vitest v4 while maintaining support for earlier versions.

Release Notes:

  • Fixed vitest test running and debugging for projects using vitest v4

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 21, 2025
@freddyfallon freddyfallon marked this pull request as ready for review November 21, 2025 13:04
@freddyfallon
Copy link
Author

Note that I built the project and tested it with both vitest 3 and 4. I notice that Webstorm is also having this problem!

"Bun should come before Node"
);
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we actually want these tests that I added. Like how useful are they really?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't think we need them

@freddyfallon
Copy link
Author

freddyfallon commented Nov 21, 2025

Ah, I tested this on v1, v2, v3, and v4 and they all worked. However, I did get this when running on v0.34.6:

throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);

So I guess this PR will fix running modern vitest tests, but will break anything pre v1. Let me know if you want me to handle that.

@cole-miller
Copy link
Member

Thanks!

@cole-miller cole-miller enabled auto-merge (squash) December 15, 2025 15:43
@cole-miller cole-miller merged commit d52defe into zed-industries:main Dec 15, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Dec 15, 2025
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…lity (zed-industries#43241)

## Summary

This PR updates the vitest test runner integration to use the modern
`--no-file-parallelism` flag instead of the deprecated
`--poolOptions.forks.minForks=0` and `--poolOptions.forks.maxForks=1`
flags.

## Changes

- Replaced verbose pool options with `--no-file-parallelism` flag in
both file-level and symbol-level vitest test tasks
- This change works with vitest v4 while maintaining backwards
compatibility with earlier versions (or 3 at least!)

## Testing

- Added test `test_vitest_uses_no_file_parallelism_flag` that verifies:
  - The `--no-file-parallelism` flag is present in generated test tasks
  - The deprecated `poolOptions` flags are not present
- Manually tested with both vitest v4 and older versions to confirm
backwards compatibility
- All existing tests pass

## Impact

This allows Zed users to run and debug vitest tests in projects using
vitest v4 while maintaining support for earlier versions.

Release Notes:

- Fixed vitest test running and debugging for projects using vitest v4

---------

Co-authored-by: Cole Miller <cole@zed.dev>
@freddyfallon freddyfallon deleted the fix-vite4-gutter-issue branch December 22, 2025 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

2 participants