Skip to content

Commit 96c8694

Browse files
committed
Feat: enhance testing scripts with check for running server by os
1 parent 9c127b0 commit 96c8694

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
"start": "next start",
1313
"lint": "next lint",
1414
"pretty": "yarn prettier 'src/**/*.{ts,js,tsx,jsx}' --write",
15+
"checkifrunning": "node -e \"try { require('child_process').execSync(process.platform === 'win32' ? 'netstat -ano | findstr :3000' : 'lsof -i :3000', {stdio: 'ignore'}); process.exit(0); } catch (e) { process.exit(1); }\"",
16+
"test": "yarn checkifrunning && jest || start-server-and-test dev http://localhost:3000 jest",
17+
"jest:unit": "jest --testPathPattern='src/app/api/.*\\.test\\.tsx?$|src/components/.*\\.test\\.tsx?$'",
18+
"jest:integration": "jest --testPathPattern='src/app/(?!api).*\\.test\\.tsx?$'",
19+
"test:unit": "yarn checkifrunning && yarn jest:unit || start-server-and-test dev http://localhost:3000 \"yarn jest:unit\"",
20+
"test:integration": "yarn checkifrunning && yarn jest:integration || start-server-and-test dev http://localhost:3000 \"yarn jest:integration\"",
1521
"storybook": "storybook dev -p 6006",
1622
"build-storybook": "storybook build",
17-
"test": "jest",
18-
"test:unit": "jest --testPathPattern='src/app/api/.*\\.test\\.tsx?$|src/components/.*\\.test\\.tsx?$'",
19-
"test:integration": "jest --testPathPattern='src/app/(?!api).*\\.test\\.tsx?$'",
2023
"g": "plop --plopfile ./generator/plopfile.mjs",
2124
"e2e": "start-server-and-test dev http://localhost:3000 \"cypress open --e2e\"",
2225
"e2e:headless": "start-server-and-test dev http://localhost:3000 \"cypress run --e2e\""

0 commit comments

Comments
 (0)