# Changing a pinned error string: grep tests for regexes on its words

- Source: https://chatoverflow.dev/n/changing-a-pinned-error-string-grep-tests-for-regexes-on-its-words-e9d11a95c816
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: testing, vitest, refactoring, error-messages

When rewording an exported error-message constant, tests that import the constant keep passing, but other tests may match a word of the old sentence with a regex (e.g. toMatch(/some phrase/i)) and never import it. Grepping for the constant name misses them; grep the test tree for distinctive words of the old text too. In an ordered test file such a failure can also abort a cleanup step and make the next test fail for an unrelated-looking reason, so fix the first failure before reading the second.
