diff --git a/.env.development b/.env.development index d9c8b2d93e4..6c92036270f 100644 --- a/.env.development +++ b/.env.development @@ -4,3 +4,4 @@ VITE_SERVER_URL=http://localhost:8001 VITE_DISCORD_CLIENT_ID=1234567890 VITE_GOOGLE_CLIENT_ID=1234567890 VITE_I18N_DEBUG=1 +VITE_PORT=8000 diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index de62932d432..71b88913257 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -52,7 +52,10 @@ describe("Abilities - Quick Draw", () => { expect(pokemon.battleData.abilitiesApplied).contain(Abilities.QUICK_DRAW); }, 20000); - test("does not triggered by non damage moves", async () => { + test("does not triggered by non damage moves", { + timeout: 20000, + retry: 5 + }, async () => { await game.startBattle([Species.SLOWBRO]); const pokemon = game.scene.getPlayerPokemon(); @@ -67,7 +70,8 @@ describe("Abilities - Quick Draw", () => { expect(pokemon.isFainted()).toBe(true); expect(enemy.isFainted()).toBe(false); expect(pokemon.battleData.abilitiesApplied).not.contain(Abilities.QUICK_DRAW); - }, 20000); + } + ); test("does not increase priority", async () => { vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.EXTREME_SPEED)); diff --git a/src/vite.env.d.ts b/src/vite.env.d.ts index e70b97d3352..a2acc658a10 100644 --- a/src/vite.env.d.ts +++ b/src/vite.env.d.ts @@ -1,6 +1,7 @@ /// interface ImportMetaEnv { + readonly VITE_PORT?: string; readonly VITE_BYPASS_LOGIN?: string; readonly VITE_BYPASS_TUTORIAL?: string; readonly VITE_API_BASE_URL?: string; diff --git a/vite.config.ts b/vite.config.ts index 9f5aeb31c02..6dce1272ee6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import tsconfigPaths from 'vite-tsconfig-paths'; export const defaultConfig = { @@ -20,10 +20,17 @@ export const defaultConfig = { }; -export default defineConfig(({mode}) => ({ - ...defaultConfig, - esbuild: { - pure: mode === 'production' ? [ 'console.log' ] : [], - keepNames: true, - }, -})); +export default defineConfig(({mode}) => { + const envPort = Number(loadEnv(mode, process.cwd()).VITE_PORT); + + return ({ + ...defaultConfig, + esbuild: { + pure: mode === 'production' ? ['console.log'] : [], + keepNames: true, + }, + server: { + port: !isNaN(envPort) ? envPort : 8000, + } + }); +});