Skip to content

VBC-017: fake-test-assertion

error

Category: core
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: testing clean-code

What it reports

Trivially true test assertion at line {line}. This test always passes regardless of the code under test and provides zero confidence. Write a real assertion that can actually fail when the implementation is broken.

Flagged

js
expect(true).toBe(true);
js
assert.ok(true);

Not flagged

js
expect(sum(1, 2)).toBe(3);

Pattern

regex
(expect\(true\)\.(toBe|toEqual|toStrictEqual)\(true\)|expect\(1\)\.(toBe|toEqual)\(1\)|assert\.equal\(true,\s*true\)|assert\.ok\(true\)|assert\.isTrue\(true\))

Released under the MIT License.