From d52defe35a6e5fde07257a67e049383437f538f1 Mon Sep 17 00:00:00 2001 From: Freddy Fallon Date: Mon, 15 Dec 2025 15:55:54 +0000 Subject: [PATCH] Fix vitest test running and debugging for v4 with backwards compatibility (#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 --- crates/languages/src/typescript.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs index a7aa1bc49c0132b01d0fe45d94a29af4efac6602..7daf178d37229a5b051461e199c3dbf8d830cf22 100644 --- a/crates/languages/src/typescript.rs +++ b/crates/languages/src/typescript.rs @@ -111,8 +111,7 @@ impl PackageJsonData { "--".to_owned(), "vitest".to_owned(), "run".to_owned(), - "--poolOptions.forks.minForks=0".to_owned(), - "--poolOptions.forks.maxForks=1".to_owned(), + "--no-file-parallelism".to_owned(), VariableName::File.template_value(), ], cwd: Some(TYPESCRIPT_VITEST_PACKAGE_PATH_VARIABLE.template_value()), @@ -130,8 +129,7 @@ impl PackageJsonData { "--".to_owned(), "vitest".to_owned(), "run".to_owned(), - "--poolOptions.forks.minForks=0".to_owned(), - "--poolOptions.forks.maxForks=1".to_owned(), + "--no-file-parallelism".to_owned(), "--testNamePattern".to_owned(), format!( "\"{}\"",