Skip to content

QA-ENV-001 — Environment coupling in test ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-ENV-001.

FieldValue
Severitywarning
Confidencemedium
Tierquarantine
Measured FP rate100% (n=20)
Evidence levelE1
QA impactFlaky-test risk (FLAKY-RISK)
False-positive risk (author estimate)medium
Autofix availableno
Languagestypescript, javascript
Frameworksjest, vitest, playwright
Detection strategyLEXICAL (regex heuristic)
Introduced inv0.2.0

Why this fails in production ​

Locale-less date formatting depends on the machine's timezone and locale — passes on your laptop, fails on CI.

What gets flagged (real detector output) ​

Environment coupling (timezone/locale): `.toLocaleDateString()`.

Example from this rule's own must-fire fixture: tests/fixtures/QA-ENV-001/must-fire/coupled.spec.ts

The fix ​

Pass an explicit locale + timeZone, or assert on ISO strings / fixed timestamps.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-ENV-001/must-not-fire/code-as-test-data.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
apache-airflow4
dubinc-dub5
getsentry-sentry1
grafana-grafana4
hashicorp-vault1
positive-fixtures3
puppeteer-puppeteer33
SeleniumHQ-selenium1
sveltejs-kit8
vercel-next-js6
vitejs-vite6
vitest-dev-vitest2
withastro-astro39
yarnpkg-berry5

Released under the MIT License.