dx: test-with-server was not terminating the server
Massimo Melina committed
May 23, 2025 at 18:12 UTC
d062291c3c5f9e891eda9deb2dacd99819e26808
1 file changed
+1
-1
package.json
+1
-1
@@ -19,7 +19,7 @@
19
"server-for-test": "node dist/src --cwd tests/work --config tests --debug",
20
"server-for-test-dev": "cross-env DEV=1 FRONTEND_PROXY=3005 ADMIN_PROXY=3006 nodemon --ignore tests/ --watch src -e ts,tsx --exec tsx src -- --cwd tests/work --config tests",
21
"test": "node --import tsx --test tests/test.ts",
22
- "test-with-server": "rm -rf tests/work && node dist/src --cwd tests/work --config tests & pid=$! && sleep 2 && node --import tsx --test tests/test.ts; _exit=$?; kill $pid; exit $_exit",
22
+ "test-with-server": "rm -rf tests/work && (node dist/src --cwd tests/work --config tests & echo $! > .server_pid) && sleep 2 && node --import tsx --test tests/test.ts; _exit=$?; SERVER_PID=$(cat ./.server_pid); kill \"$SERVER_PID\" 2>/dev/null || true; rm -f ./.server_pid; exit $_exit",
23
"test-ui": "npx playwright test --ui",
24
"pub": "cd dist && npm publish",
25
"dist": "npm run build-all && npx playwright test && npm run dist-bin",