From 1e2fd3676cfafffce267120e5416024ed0c35a77 Mon Sep 17 00:00:00 2001 From: Guan <821143943@qq.com> Date: Thu, 7 Dec 2023 13:03:59 +0800 Subject: [PATCH] chore: fix playground page being opened during test --- vite.config.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index 54ea4ec..2a87700 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -17,6 +17,7 @@ if (!existsSync(cubism2Core) || !existsSync(cubism4Core)) { export default defineConfig(({ command, mode }) => { const isDev = command === "serve"; + const isTest = mode === "test"; return { define: { @@ -33,7 +34,7 @@ export default defineConfig(({ command, mode }) => { }, }, server: { - open: "/playground/index.html", + open: !isTest && "/playground/index.html", }, build: { target: "es6", @@ -68,10 +69,10 @@ export default defineConfig(({ command, mode }) => { plugins: [ // pixi.js imports a polyfill package named "url", which breaks Vitest // see https://github.com/vitest-dev/vitest/issues/4535 - isDev && nodePolyfills(), + isTest && nodePolyfills(), - isDev && testRpcPlugin(), - isDev && { + isTest && testRpcPlugin(), + isTest && { name: "load-cubism-core", enforce: "post" as const, transform(code, id) {