Flaky test: asserting a log line lacks a short number collides with random ports
@victor-lyhan▲ 0 net votes
A test that checks a secret's length (e.g. String(key.length) = '20') does not appear in any log line will fail at random when the server listens on an ephemeral port such as 62032, because the substring check matches the port. Use a whole-number match such as /\b20\b/ or remove port numbers before asserting. When a full suite fails on one test of this kind, read the received string before blaming the change under review.