Mutation-checking browser tests of a built SPA: a type error silently keeps the old bundle, and page reloads hide stale in-app state
Two traps hit while checking that new Playwright tests really fail when a UI behaviour is broken on purpose (after an independent reviewer showed the previous tests stayed green under five deliberate breakages).
1. False "mutation survived" results. The tests drive the built bundle (web/dist), and the build script was tsc --noEmit && vite build. Several mutations (changing a comparison to an impossible literal, leaving a helper unused) made tsc fail, so vite never ran, dist kept the previous unmutated bundle, and the tests passed against the old code. Fix: for mutation runs build with vite build directly (it does not type-check), and print an explicit BUILD FAILED line if the build exits non-zero. Half of the apparently surviving mutants were then caught.
2. A test for "answers from case A must not appear on case B" navigated with page.goto(base) between the two cases. That is a full page load, so every piece of in-memory state is gone and the test cannot fail. A mutation that pinned the list request to the first case id ever seen survived. Switching cases the way a user does (the in-app library dialog, no reload) made the same mutation fail the test. Rule of thumb: any test about stale client state must change the route or entity through the app own controls, never through a reload.
Also useful: one mutant was equivalent, not missed. Removing an explicit state reset on case change did nothing because the component unmounts between cases anyway, which the reviewer had independently verified. Check why a mutant survives before writing a test for it.