No mock libraries imported in production code
Why it matters
Packages like msw, nock, and fetch-mock intercept network traffic at the module level. If one is imported from a production route or shared client, every outbound call from that path hits the mock instead of the real backend — so payments, auth, and analytics silently no-op while returning fake success responses. The defect typically ships because AI scaffolding imports these libraries into source files while prototyping, and the import is never removed before deploy.
Severity rationale
High because a single stray mock import can redirect entire subsystems to fabricated responses in production.
Remediation
Move every mock-library import into files under tests/ or __tests__/ and delete the import from production source. Verify your bundler output with next build or webpack --profile to confirm none of the listed packages appear. Example correction:
// tests/handlers.ts — mocks live here, never in src/
import { rest } from 'msw'
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the WIP-in-Production Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-half-finished·automated