Skip to content

QA-TQUAL-002 — Tautological assertion ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-TQUAL-002.

FieldValue
Severityerror
Confidencehigh
Tierquarantine
Measured FP rate53% (n=32)
Evidence levelE2
QA impactFalse-green risk (FALSE-GREEN)
False-positive risk (author estimate)low
Autofix availableno
Languagestypescript, javascript
Frameworksjest, vitest, playwright
Detection strategyLEXICAL (AST-stripped text pattern)
Introduced inv0.1.0

Why this fails in production ​

expect(true).toBe(true), assert 1 == 1, and equivalent tautologies compare a literal to itself — they can never fail, by construction, regardless of what the code under test actually did. This is a stronger version of the no-assertion problem: it doesn't just fail to verify anything, it actively masquerades as verification while providing a mathematical guarantee of always passing. It most often survives code review specifically because it looks like a real assertion at a glance.

What gets flagged (real detector output) ​

Tautological assertion: `expect(true).toBe(true)`.

Example from this rule's own must-fire fixture: tests/fixtures/QA-TQUAL-002/must-fire/tautological.spec.ts

The fix ​

Assert on actual output of the code under test.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-TQUAL-002/must-not-fire/clean.spec.ts — a legitimate, similar-looking pattern this rule correctly leaves alone.

Corpus-measured false-positive risk ​

Real occurrence counts from npm run corpus:audit against actively-maintained OSS repos — reproduce yourself, don't just trust this table (see the false-positive audit):

RepoOccurrences
calcom-cal1
getsentry-sentry2
grafana-grafana3
negative-fixtures1
nextauthjs-next-auth2
positive-fixtures12
streamlit-streamlit1
vercel-next-js5
vitest-dev-vitest137

Released under the MIT License.