From 09821941b5f90b864c548fa626f79169de939aa3 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 38b9598f2..eccf8a2fb 100755 --- a/index.ts +++ b/index.ts @@ -348,24 +348,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 fa842a775..c02d0301f 100644 --- a/template/base/package.json +++ b/template/base/package.json @@ -2,6 +2,7 @@ "private": true, "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 61db75720..87cad189b 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.3.8" diff --git a/template/config/cypress/package.json b/template/config/cypress/package.json index 77d5a5062..88b052abc 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.5.1", diff --git a/template/config/nightwatch-ct/package.json b/template/config/nightwatch-ct/package.json index 8982106f5..b5103b808 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.3.8" diff --git a/template/config/nightwatch/package.json b/template/config/nightwatch/package.json index 4f281a775..e39d4c6b3 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.3.2", diff --git a/template/config/playwright/package.json b/template/config/playwright/package.json index a66b93aaa..1aa817e4a 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.40.0" diff --git a/template/config/vitest/package.json b/template/config/vitest/package.json index a87f97253..36b8dd9bd 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.3.8"