Skip to content

QA-PW-125 — Global setup mutating shared state ​

← Back to the rule catalog

Generated from the rule registry. Get the same detail from the CLI with mjolnir explain QA-PW-125.

FieldValue
Severitywarning
Confidencemedium
Tierextended
Measured FP rate0% (n=10)
Evidence levelE1
QA impactTest hygiene debt (HYGIENE)
False-positive risk (author estimate)medium
Autofix availableno
Languagestypescript, javascript
Frameworksplaywright
Detection strategyLEXICAL (regex heuristic)
Introduced inv0.3.0

Why this fails in production ​

Migrations/seeds/deletes against a shared environment break every other pipeline and developer pointing at it — and the damage happens before any test runs.

What gets flagged (real detector output) ​

Global setup mutates shared state: `execSync("npx prisma migrate deploy --schema ./prisma/stagin…`.

Example from this rule's own must-fire fixture: tests/fixtures/QA-PW-125/must-fire/global-setup-auth.ts

The fix ​

Target an ephemeral per-run environment (testcontainers, branch DB) instead of shared infrastructure.

Confirmed NOT to fire on the corresponding clean pattern ​

Verified against tests/fixtures/QA-PW-125/must-not-fire/ephemeral-setup.ts — a legitimate, similar-looking pattern this rule correctly leaves alone.

Corpus-measured false-positive risk ​

UNKNOWN — this rule has not (yet) fired in any of the real OSS repos tracked by npm run corpus:audit (see the false-positive audit). That is not the same as "never fires incorrectly" — it just means no occurrence, correct or not, has been observed there yet.

Released under the MIT License.