Skip to content

QA-TQUAL-009 — Assertion in promise chain that is never awaited ​

← Back to the rule catalog

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

FieldValue
Severityerror
Confidencehigh
Tierquarantine
Measured FP ratenot yet measured
Evidence levelE2
QA impactFalse-green risk (FALSE-GREEN)
False-positive risk (author estimate)low
Autofix availableno
Languagestypescript, javascript
Frameworksjest, vitest, playwright
Detection strategyLEXICAL
Introduced inv0.2.0

Why this fails in production ​

A promise-returning assertion (expect(...).resolves..., an async matcher, a .then() chain containing an assertion) that is never awaited or returned from the test function completes on its own schedule, AFTER the test function has already returned and the runner has already recorded a result. If the assertion inside that unawaited promise later rejects, most runners either report it as an unhandled rejection attributed to a DIFFERENT, already-finished test, or drop it entirely — the test that actually contained the failing check reports as passed no matter what that check found.

What gets flagged (real detector output) ​

Assertion inside a `.then()` whose promise is never awaited or returned.

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

The fix ​

Await the promise (await ...), return it from the test, or convert to async/await with a top-level expect.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-TQUAL-009/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
cypress-io-cypress-realworld-app10
cypress-io-kitchensink6
grafana-grafana1
positive-fixtures2
tanstack-query1

Released under the MIT License.