dx: test-with-ui will now work on the working tree

Massimo Melina committed Jan 28, 2026 at 12:17 UTC 1fe12849ca82acb3a928488245cee2cdcdd60c65
2 files changed +3 -3
package.json
+2 -2
@@ -21,9 +21,9 @@
21 "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",
22 "test": "node --import tsx --test tests/test.ts",
23 "test-with-server": "sh -c 'npm run port-is-free && tsc && rm -rf tests/work tests/tmp && (node dist/src --cwd tests/work --config tests & echo $! > .server_pid) && sleep 2 && node --import tsx --test \"$@\" tests/test.ts; _exit=$?; if [ -f ./.server_pid ]; then SERVER_PID=$(cat ./.server_pid); kill \"$SERVER_PID\" 2>/dev/null || true; rm -f ./.server_pid; fi; exit $_exit' --",
24 - "port-is-free": "node -e \"process.exit(await fetch('http://localhost:8081').then(() => console.log('BUSY') || 1, () => 0))\"",
24 + "port-is-free": "node -e \"const port=process.argv[1]||8081;process.exit(await fetch('http://localhost:'+port).then(() => console.log('BUSY')||1, () => 0))\" --",
25 "test-ui": "npx playwright test frontend && npx playwright test serial",
26 - "test-with-ui": "npx playwright test --ui",
26 + "test-with-ui": "sh -c 'npm run port-is-free -- 3005 && npm run start-frontend & npm run port-is-free -- 3006 && npm run start-admin & cross-env TEST_WITH_UI=1 npx playwright test --ui'",
27 "pub": "cd dist && npm publish",
28 "dist": "STASHED=; if ! git diff-index --quiet HEAD --; then git stash push -m 'dist' && STASHED=1; fi; CI=1 FORCE_COLOR=1 npm run dist-uncommitted || (EXIT_CODE=$?; [ -n \"$STASHED\" ] && git stash pop; exit $EXIT_CODE); [ -n \"$STASHED\" ] && git stash pop",
29 "dist-uncommitted": "npm audit --omit=dev --audit-level=moderate && npm run build-all && npm run test-ui && npm run dist-bin",
playwright.config.ts
+1 -1
@@ -94,7 +94,7 @@ export default defineConfig({
94 },
95 /* Run your local dev server before starting the tests */
96 webServer: [{
97 - command: 'npm run server-for-test', // you can run server-for-test-dev instead, but then you need frontend and admin to be running too
97 + command: 'npm run server-for-test' + (process.env.TEST_WITH_UI ? '-dev' : ''), // use server-for-test-dev only for "test-with-ui"
98 url: 'http://127.0.0.1:8081',
99 reuseExistingServer: !process.env.CI,
100 }, { // launch a second server for tests with an empty/default config