Why this matters
Avoids false positives and ensures the test actually waits for async completion.
For Promises, return/await the expectation and prefer await expect(p).resolves|rejects...; do not use the callback done().
Avoids false positives and ensures the test actually waits for async completion.
Side-by-side examples engineers can pattern-match during review.
test('loads', (done) => {
fetch(url).then(r => {
expect(r.ok).toBe(true);
done();
});
});test('loads', async () => {
await expect(fetch(url)).resolves.toHaveProperty('ok', true);
});await expect(fetch(url)).resolves.toBeDefined()test('x',(done)=>{ /* ... */ done(); })From the same buckets as this rule.
Reject PRs adding real PAN/CVV in fixtures, seeds, or mocks. Only use Luhn-valid test PANs from the gateway or opaque tokens (e.g., tok_) and never include CVV. Add a check to fail if a PAN regex is matched. (PCI DSS data minimization)