From dcdc701f83b7e5b33b2ff65409a1afbde004643a Mon Sep 17 00:00:00 2001 From: lihbr Date: Tue, 10 Dec 2024 20:09:17 +0100 Subject: [PATCH] test: don't start proxy during tests --- vite.config.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index eedc296..d6d38b8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,5 @@ import * as path from "node:path" +import process from "node:process" import akte from "akte/vite" import getPort from "get-port" @@ -71,15 +72,17 @@ export default defineConfig({ { name: "functions:watch", async configureServer() { - const port = await getPort({ port: 5174 }) + if (process.env.NODE_ENV === "development") { + const port = await getPort({ port: 5174 }) - // Ensures we only run the secondary server once - if (port === 5174) { - listenAndWatch("./src/functions.server.ts", { - port, - autoClose: true, - staticDirs: [], - }) + // Ensures we only run the secondary server once + if (port === 5174) { + listenAndWatch("./src/functions.server.ts", { + port, + autoClose: true, + staticDirs: [], + }) + } } }, },