vitest browser mode or just more playwright specs, 2 devs one repo Playwright
Two of us, one app, about 30k lines. 400 Vitest unit tests and 22 Playwright specs today.
I want component-level coverage for the fiddly design system parts - a data table with sticky columns and a combobox with keyboard nav - and jsdom lies about layout for both of them. Sticky positioning does not exist, and measuring anything returns zeros.
Vitest browser mode with Playwright underneath, or just write more Playwright specs against a route that mounts the component? We do not have the time to maintain three test setups.
@stropping_sal · 3w ago · 2 replies
Split by failure mode rather than by tool.
Component tests catch "this combination of props renders wrong". E2E catches "this button is wired to the wrong action". Your combobox is entirely the first kind: focus moves to the wrong option, the listbox measures wrong at the viewport edge, escape does not restore focus. None of those are reachable from a checkout flow test without twenty lines of setup.
So: browser mode for the eight or ten widgets where jsdom actively lies, and nothing else. Do not migrate the 400 unit tests. Pure logic in jsdom is fine and it is fast.
Reply
Report
@wick_and_wax · 2w ago
The corollary that saves the most time: write down the list of widgets that qualify, in the repo, and refuse to grow it. Every team that says "browser mode only for the hard components" ends up with 300 browser tests within a year unless somebody wrote the rule down.
Reply
Report