From bf64fede882f094695300bd0f72184f1fb1595c2 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Sat, 25 Nov 2023 12:23:32 +0100 Subject: [PATCH] feat: generate start and test NPM scripts (#303) --- index.ts | 18 +++++++++--------- template/base/package.json | 1 + template/config/cypress-ct/package.json | 3 ++- template/config/cypress/package.json | 3 ++- template/config/nightwatch-ct/package.json | 3 ++- template/config/nightwatch/package.json | 3 ++- template/config/playwright/package.json | 3 ++- template/config/vitest/package.json | 3 ++- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/index.ts b/index.ts index f552cfd8..08ccadc1 100755 --- a/index.ts +++ b/index.ts @@ -372,24 +372,24 @@ async function init() { if (needsPinia) { render('config/pinia') } - if (needsVitest) { - render('config/vitest') - } if (needsCypress) { render('config/cypress') } - if (needsCypressCT) { - render('config/cypress-ct') - } if (needsNightwatch) { render('config/nightwatch') } - if (needsNightwatchCT) { - render('config/nightwatch-ct') - } if (needsPlaywright) { render('config/playwright') } + if (needsVitest) { + render('config/vitest') + } + if (needsCypressCT) { + render('config/cypress-ct') + } + if (needsNightwatchCT) { + render('config/nightwatch-ct') + } if (needsTypeScript) { render('config/typescript') diff --git a/template/base/package.json b/template/base/package.json index d30724e6..289f591d 100644 --- a/template/base/package.json +++ b/template/base/package.json @@ -3,6 +3,7 @@ "type": "module", "scripts": { "dev": "vite", + "start": "npm run dev", "build": "vite build", "preview": "vite preview" }, diff --git a/template/config/cypress-ct/package.json b/template/config/cypress-ct/package.json index 99944d23..eff53e91 100644 --- a/template/config/cypress-ct/package.json +++ b/template/config/cypress-ct/package.json @@ -1,7 +1,8 @@ { "scripts": { "test:unit": "cypress run --component", - "test:unit:dev": "cypress open --component" + "test:unit:dev": "cypress open --component", + "test": "npm run test:unit" }, "dependencies": { "vue": "^3.4.27" diff --git a/template/config/cypress/package.json b/template/config/cypress/package.json index 02634ae5..420efe05 100644 --- a/template/config/cypress/package.json +++ b/template/config/cypress/package.json @@ -1,7 +1,8 @@ { "scripts": { "test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'", - "test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'" + "test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'", + "test": "npm run test:e2e" }, "devDependencies": { "cypress": "^13.10.0", diff --git a/template/config/nightwatch-ct/package.json b/template/config/nightwatch-ct/package.json index 907a5482..defdb4ec 100644 --- a/template/config/nightwatch-ct/package.json +++ b/template/config/nightwatch-ct/package.json @@ -1,6 +1,7 @@ { "scripts": { - "test:unit": "nightwatch src/**/__tests__/*" + "test:unit": "nightwatch src/**/__tests__/*", + "test": "npm run test:unit" }, "dependencies": { "vue": "^3.4.27" diff --git a/template/config/nightwatch/package.json b/template/config/nightwatch/package.json index 1ba221d8..2408db98 100644 --- a/template/config/nightwatch/package.json +++ b/template/config/nightwatch/package.json @@ -1,6 +1,7 @@ { "scripts": { - "test:e2e": "nightwatch tests/e2e/*" + "test:e2e": "nightwatch tests/e2e/*", + "test": "npm run test:e2e" }, "devDependencies": { "nightwatch": "^3.6.3", diff --git a/template/config/playwright/package.json b/template/config/playwright/package.json index d4e4fcb6..f417f7a3 100644 --- a/template/config/playwright/package.json +++ b/template/config/playwright/package.json @@ -1,6 +1,7 @@ { "scripts": { - "test:e2e": "playwright test" + "test:e2e": "playwright test", + "test": "npm run test:e2e" }, "devDependencies": { "@playwright/test": "^1.44.1" diff --git a/template/config/vitest/package.json b/template/config/vitest/package.json index d85e0808..92380107 100644 --- a/template/config/vitest/package.json +++ b/template/config/vitest/package.json @@ -1,6 +1,7 @@ { "scripts": { - "test:unit": "vitest" + "test:unit": "vitest", + "test": "npm run test:unit" }, "dependencies": { "vue": "^3.4.27"