From 2584397bfb051160f8e206e320c2b03194fa4cdd Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 1 Jun 2022 14:16:51 +0800 Subject: [PATCH] chore: change default preview port to 4173 The default preview port was changed to 4173 in Vite 2.8: To avoid Vite preview server auto-increment the port number in the case that port 4173 is occupied, therefore failing E2E tests unexpectedly, we still have to explicitly set the port number in the npm scripts. --- template/base/package.json | 2 +- template/config/cypress-ct/cypress.json | 2 +- template/config/cypress/cypress.json | 2 +- template/config/cypress/package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/template/base/package.json b/template/base/package.json index 6fc7aa05..867abaa0 100644 --- a/template/base/package.json +++ b/template/base/package.json @@ -2,7 +2,7 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview --port 5050" + "preview": "vite preview --port 4173" }, "dependencies": { "vue": "^3.2.36" diff --git a/template/config/cypress-ct/cypress.json b/template/config/cypress-ct/cypress.json index 3d372252..a10a9035 100644 --- a/template/config/cypress-ct/cypress.json +++ b/template/config/cypress-ct/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:5050", + "baseUrl": "http://localhost:4173", "component": { "componentFolder": "src", "testFiles": "**/__tests__/*.spec.{js,ts,jsx,tsx}" diff --git a/template/config/cypress/cypress.json b/template/config/cypress/cypress.json index 6ba19871..fe9238de 100644 --- a/template/config/cypress/cypress.json +++ b/template/config/cypress/cypress.json @@ -1,3 +1,3 @@ { - "baseUrl": "http://localhost:5050" + "baseUrl": "http://localhost:4173" } diff --git a/template/config/cypress/package.json b/template/config/cypress/package.json index 6b885633..79bf45d0 100644 --- a/template/config/cypress/package.json +++ b/template/config/cypress/package.json @@ -1,7 +1,7 @@ { "scripts": { - "test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'", - "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'" + "test:e2e": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress open'", + "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:4173/ 'cypress run'" }, "devDependencies": { "cypress": "^9.7.0", -- 2.39.5