From 821400b8c17f8cffff6f6521c8dfa4a66b1f8372 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Wed, 2 Oct 2024 16:37:38 +0200 Subject: [PATCH] fix(vitest): don't start a websocket server if api is disabled (#6617) --- packages/vitest/src/node/plugins/index.ts | 1 + packages/vitest/src/node/plugins/workspace.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/vitest/src/node/plugins/index.ts b/packages/vitest/src/node/plugins/index.ts index fb82f7884b3e..fa2d50e7f3df 100644 --- a/packages/vitest/src/node/plugins/index.ts +++ b/packages/vitest/src/node/plugins/index.ts @@ -98,6 +98,7 @@ export async function VitestPlugin( ...testConfig.api, open, hmr: false, + ws: testConfig.api?.middlewareMode ? false : undefined, preTransformRequests: false, fs: { allow: resolveFsAllow(getRoot(), testConfig.config), diff --git a/packages/vitest/src/node/plugins/workspace.ts b/packages/vitest/src/node/plugins/workspace.ts index 1c5ff4878835..6e4af78efddc 100644 --- a/packages/vitest/src/node/plugins/workspace.ts +++ b/packages/vitest/src/node/plugins/workspace.ts @@ -85,6 +85,7 @@ export function WorkspaceVitestPlugin( watch: null, open: false, hmr: false, + ws: false, preTransformRequests: false, middlewareMode: true, fs: {