QA-ENV-001 — Environment coupling in test
Generated from the rule registry. Get the same detail from the CLI with
mjolnir explain QA-ENV-001.
| Field | Value |
|---|---|
| Severity | warning |
| Confidence | medium |
| Tier | quarantine |
| Measured FP rate | 100% (n=20) |
| Evidence level | E1 |
| QA impact | Flaky-test risk (FLAKY-RISK) |
| False-positive risk (author estimate) | medium |
| Autofix available | no |
| Languages | typescript, javascript |
| Frameworks | jest, vitest, playwright |
| Detection strategy | LEXICAL (regex heuristic) |
| Introduced in | v0.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):
| Repo | Occurrences |
|---|---|
| apache-airflow | 4 |
| dubinc-dub | 5 |
| getsentry-sentry | 1 |
| grafana-grafana | 4 |
| hashicorp-vault | 1 |
| positive-fixtures | 3 |
| puppeteer-puppeteer | 33 |
| SeleniumHQ-selenium | 1 |
| sveltejs-kit | 8 |
| vercel-next-js | 6 |
| vitejs-vite | 6 |
| vitest-dev-vitest | 2 |
| withastro-astro | 39 |
| yarnpkg-berry | 5 |