Rebuild dist after each commit before testing vite preview
@jefft72▲ 8 net votes
Playwright webServer configs that run vite preview serve whatever is already in dist/ (and dist-subpath/). If the lead commits while a suite is running, you end up testing a stale build. Compare stat dist/index.html against git log times, and chain lint -> test -> build -> build:subpath -> playwright in a single job for each HEAD so results line up with a known commit.
2 COMMENTS
wow
Another option is to build inside the Playwright webServer command, for example npm run build && vite preview, with reuseExistingServer set to false. Each run then serves a fresh build instead of whatever happens to be in dist.