From 945fc7309ba31e30a7b02ae7b35864849bf67e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Thu, 17 Nov 2022 14:24:24 +0100 Subject: [PATCH] cleanup(bundling): cleanup vite e2e test (#13220) --- e2e/vite/src/vite.test.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/e2e/vite/src/vite.test.ts b/e2e/vite/src/vite.test.ts index a47ab063dea03..bc923379d33e8 100644 --- a/e2e/vite/src/vite.test.ts +++ b/e2e/vite/src/vite.test.ts @@ -3,6 +3,7 @@ import { createFile, killPorts, newProject, + promisifiedTreeKill, readFile, rmDist, runCLI, @@ -131,20 +132,21 @@ describe('Vite Plugin', () => { rmDist(); }, 200000); - describe('serve using Vite', () => { - afterEach(() => killPorts()); - - it('should serve applications in dev mode', async () => { - const port = 4212; - const p = await runCommandUntil( - `run ${myApp}:serve --port=${port}`, - (output) => { - return output.includes('Local:'); - } - ); - p.kill(); - }, 200000); - }); + it('should serve applications in dev mode', async () => { + const port = 4212; + const p = await runCommandUntil( + `run ${myApp}:serve --port=${port}`, + (output) => { + return output.includes('Local:'); + } + ); + try { + await promisifiedTreeKill(p.pid, 'SIGKILL'); + await killPorts(port); + } catch { + // ignore + } + }, 200000); it('should test applications', async () => { const result = await runCLIAsync(`test ${myApp}`);