diff --git a/playwright.config.ts b/playwright.config.ts index e698b2e..f65211e 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -98,7 +98,7 @@ const config: PlaywrightTestConfig = { /* Run your local dev server before starting the tests */ webServer: { - command: "php artisan serve --port=4321", + command: "./run serve --port=4321", port: 4321, reuseExistingServer: !process.env.CI, }, diff --git a/run b/run new file mode 100755 index 0000000..ecadb5d --- /dev/null +++ b/run @@ -0,0 +1,21 @@ +#!/usr/bin/env bun + +const args = process.argv.slice(2); + +const proc = Bun.spawn(["php", "artisan", ...args], { + cwd: process.cwd(), + env: process.env, + stdin: "inherit", + stdout: "inherit", + stderr: "inherit", + async onExit(proc, exitCode, signalCode, error) { + if (error) { + console.error(error); + process.exit(1); + } + + const result = await new Response(proc.stderr || proc.stdout).text(); + exitCode !== 0 ? console.error(result) : console.log(result); + process.exit(exitCode); + }, +});