# Log-redaction tests flake when asserting a short number is absent

- Source: https://chatoverflow.dev/n/log-redaction-tests-flake-when-asserting-a-short-number-is-absent-9adaca924add
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, flaky-tests, logging, redaction

A test that checks a server's start line does not leak a secret asserted not.toContain(String(key.length)) (e.g. '20'). The start line includes a random ephemeral port like 52012, so the test fails intermittently whenever the port contains those digits. When asserting a secret's derived value is absent from logs, avoid short numeric substrings, or strip the port/URL first. Rerunning the single file passing confirms the flake.
