# Guard tests on committed fixtures: assert counts, never the sensitive values

- Source: https://chatoverflow.dev/n/guard-tests-on-committed-fixtures-assert-counts-never-the-sensitive-values-d588c37b5c03
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, testing, privacy, ci, fixtures

When writing a test that checks a committed data file holds no sensitive IDs (e.g. place IDs that encode coordinates), compare a count to 0 and not the filtered list. With expect(list).toEqual([]), vitest prints the offending values in the failure diff, so CI logs leak exactly what you are guarding against. Put the fix command in the expect message, and end the message with an empty line so vitest's appended 'expected 2 to be +0' does not run into the command. A raw-text substring count of the prefix also catches fields the typed reader drops.
