Skip to content

Commit e0c7126

Browse files
committed
fix(ci): use build-then-serve for Laravel smoke test
The concurrently approach (php artisan serve + vite dev) is unreliable in CI. Instead, build Vite assets first then serve with PHP only via a new `start` script. This is simpler and avoids the race condition between the two processes.
1 parent a48e91c commit e0c7126

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

examples/__tests__/playwright.config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ const examplePath = isGettingStarted
1616
? `../getting-started/${example}`
1717
: `../${example}`;
1818

19-
// Collaboration examples that use concurrently (server + client).
19+
// Examples that use concurrently (server + client).
2020
// These run `npm run dev` which starts both processes — don't append --port.
2121
const useConcurrently = [
2222
'collaboration/hocuspocus',
2323
'collaboration/superdoc-yjs',
24-
'laravel',
2524
];
2625

2726
// Port mapping — must match vite.config or server defaults
@@ -39,13 +38,19 @@ const exampleAbsPath = resolve(__dirname, examplePath);
3938
const hasLocalNodeModules = existsSync(resolve(exampleAbsPath, 'node_modules', '.bin'));
4039
const run = hasLocalNodeModules ? `npm run --prefix ${examplePath}` : `pnpm --dir ${examplePath} run`;
4140

41+
// Laravel: build Vite assets first, then serve with PHP only (via `start` script).
42+
// The concurrently approach (php + vite dev) is unreliable in CI.
43+
const isLaravel = example === 'laravel';
44+
4245
// Start command
4346
const isCdn = example === 'cdn';
4447
const command = isCdn
4548
? `npx serve ${examplePath} -l ${port}`
46-
: useConcurrently.includes(example)
47-
? `${run} dev`
48-
: `${run} dev -- --port ${port}`;
49+
: isLaravel
50+
? `${run} start`
51+
: useConcurrently.includes(example)
52+
? `${run} dev`
53+
: `${run} dev -- --port ${port}`;
4954

5055
export default defineConfig({
5156
testDir: '.',

examples/getting-started/laravel/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"type": "module",
55
"scripts": {
66
"build": "vite build",
7-
"dev": "concurrently \"php artisan serve --host=0.0.0.0 --port=8000\" \"vite\""
7+
"dev": "concurrently \"php artisan serve --host=0.0.0.0 --port=8000\" \"vite\"",
8+
"start": "vite build && php artisan serve --host=127.0.0.1 --port=8000"
89
},
910
"dependencies": {
1011
"concurrently": "^9.0.0",

0 commit comments

Comments
 (0)