create-vue
create-vue copied to clipboard
Playwright webserver command should run build before preview?
Currently, create-vue generates a playwright config that has something like this in it:
{
webServer: {
/**
* use the dev server by default for faster feedback loop. Use the preview
* server on CI for more realistic testing
*/
command: process.env.CI
? "vite preview --port 5173"
: "vite dev",
port: 5173,
reuseExistingServer: !process.env.CI,
}
}
Shouldn't we need to run build before preview so that the app actually exists?
I ran into problems running my tests on GitHub Actions, and it took me a while to figure out that this was the cause. See: https://github.com/vitejs/vite/discussions/4572
yes you need to run build first.
in the snippet above vite preview is being run in a CI env. you can add a step to run build and then trigger a CI job to run the PW tests.