From c55630889aa9daa3a43bdf06931436b974748175 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Tue, 10 Jun 2025 14:25:07 -0400 Subject: [PATCH] debugger: Run jest tests serially (#32473) Pass `--runInBand` to jest when debugging. This prevents jest from creating a bunch of child processes that clutter the session list. It might be a bit more natural to add this argument in the test templates themselves, but I don't think we want to give up parallelism when running via `task: spawn`. Release Notes: - N/A (JS locator is still gated) --- crates/project/src/debugger/locators/node.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/project/src/debugger/locators/node.rs b/crates/project/src/debugger/locators/node.rs index 9199abef91..a3a386ecda 100644 --- a/crates/project/src/debugger/locators/node.rs +++ b/crates/project/src/debugger/locators/node.rs @@ -11,6 +11,8 @@ pub(crate) struct NodeLocator; const TYPESCRIPT_RUNNER_VARIABLE: VariableName = VariableName::Custom(Cow::Borrowed("TYPESCRIPT_RUNNER")); +const TYPESCRIPT_JEST_TASK_VARIABLE: VariableName = + VariableName::Custom(Cow::Borrowed("TYPESCRIPT_JEST")); #[async_trait] impl DapLocator for NodeLocator { @@ -41,7 +43,15 @@ impl DapLocator for NodeLocator { .join("node_modules") .join(".bin") .join(test_library); - let args = build_config.args[1..].to_vec(); + + let mut args = if test_library == "jest" + || test_library == &TYPESCRIPT_JEST_TASK_VARIABLE.template_value() + { + vec!["--runInBand".to_owned()] + } else { + vec![] + }; + args.extend(build_config.args[1..].iter().cloned()); let config = serde_json::json!({ "request": "launch",