test(ui): make ui-visual-update honour its file filter
vitest parses a bare `--update` as taking the next positional as its value, so `make ui-visual-update UI_ARGS=<path>` handed the path to the flag and ran with no filter at all: 99 files, every baseline in the repo re-recorded, any stale one blessed in silence. Two paths were worse still — the first was eaten and only the second ran. That is #196's own hazard living in the tool meant to resolve it: the rule is "refresh the reference your change moved and never one you did not cause", and the documented way to refresh one refreshed the set. `--update=true` is the whole fix, with the reason beside it because `=true` reads like something to tidy away. `make ui-visual` and `make ui-test` are unaffected — their `$(UI_ARGS)` follows `run`, with no flag to swallow it — and no other target interpolates a variable after a boolean flag. Closes #204
This commit is contained in:
@@ -160,8 +160,11 @@ ui-watch: ## Same suite, in watch mode
|
||||
ui-visual: ## Run the suite including screenshot comparisons
|
||||
@cd frontend && YJ_VISUAL=1 npx vitest run $(UI_ARGS)
|
||||
|
||||
ui-visual-update: ## Re-record the screenshot baselines
|
||||
@cd frontend && YJ_VISUAL=1 npx vitest run --update $(UI_ARGS)
|
||||
# `--update=true`, never a bare `--update`: vitest takes the following
|
||||
# positional as the flag's value, so `--update <path>` swallows the path
|
||||
# and re-records every baseline in the repo instead of the one named.
|
||||
ui-visual-update: ## Re-record the screenshot baselines (UI_ARGS=<path> to filter)
|
||||
@cd frontend && YJ_VISUAL=1 npx vitest run --update=true $(UI_ARGS)
|
||||
|
||||
ui-setup: ## Install the Vitest browser provider's own Chromium (once)
|
||||
@cd frontend && pnpm install && npx playwright install chromium
|
||||
|
||||
Reference in New Issue
Block a user