xiaohongshu
xiaohongshu
ln-635-test-isolation-auditor
Test Isolation + Anti-Patterns audit worker (L3). Checks isolation (APIs/DB/FS/Time/Random/Network), determinism (flaky, order-dependent), and 6 anti-patterns.
Full skill instructions
Specialized worker auditing test isolation and detecting anti-patterns.
Receives contextStore with isolation checklist, anti-patterns catalog, test file list.
Good: Mocked (jest.mock, sinon, nock) Bad: Real HTTP calls to external APIs
Detection:
axios.get, fetch(, http.request without mocksSeverity: HIGH
Recommendation: Mock external APIs with nock or jest.mock
Effort: M
Good: In-memory DB (sqlite :memory:) or mocked Bad: Real database (PostgreSQL, MySQL)
Detection:
beforeAll(async () => { await db.connect() }) without :memory:Severity: MEDIUM
Recommendation: Use in-memory DB or mock DB calls
Effort: M-L
Good: Mocked (mock-fs, vol) Bad: Real file reads/writes
Detection:
fs.readFile, fs.writeFile without mocksSeverity: MEDIUM
Recommendation: Mock file system with mock-fs
Effort: S-M
Good: Mocked (jest.useFakeTimers, sinon.useFakeTimers)
Bad: new Date(), Date.now() without mocks
Detection:
new Date() in test files without useFakeTimersSeverity: MEDIUM
Recommendation: Mock time with jest.useFakeTimers()
Effort: S
Good: Seeded random (Math.seedrandom, fixed seed)
Bad: Math.random() without seed
Detection:
Math.random() without seed setupSeverity: LOW
Recommendation: Use seeded random for deterministic tests
Effort: S
Good: Mocked (supertest for Express, no real ports)
Bad: Real network requests (localhost:3000, binding to port)
Detection:
app.listen(3000) in testsSeverity: MEDIUM
Recommendation: Use supertest (no real port)
Effort: M
What: Tests that pass/fail randomly
Detection:
setTimeout, setInterval without proper awaitsSeverity: HIGH
Recommendation: Fix race conditions, use proper async/await
Effort: M-L
What: Assertions on current time (expect(timestamp).toBeCloseTo(Date.now()))
Detection:
Date.now(), new Date() in assertionsSeverity: MEDIUM
Recommendation: Mock time
Effort: S
What: Tests that fail when run in different order
Detection:
Severity: MEDIUM
Recommendation: Isolate tests, reset state in beforeEach
Effort: M
What: Global variables modified across tests
Detection:
let globalVar at module levelSeverity: MEDIUM
Recommendation: Use beforeEach to reset state
Effort: S-M
What: Test with no assertions or trivial assertion (expect().toBeTruthy())
Detection:
toBeTruthy() → LiarSeverity: HIGH
Recommendation: Add specific assertions or delete test
Effort: S
Example:
createUser() but has NO assertions — always passes even if function breakscreateUser() and asserts user.name equals 'Alice', user.id is definedWhat: Test with >100 lines, testing too many scenarios
Detection:
Severity: MEDIUM
Recommendation: Split into focused tests (one scenario per test)
Effort: S-M
What: Test taking >5 seconds to run
Detection:
Severity: MEDIUM
Recommendation: Mock external deps, use in-memory DB, parallelize
Effort: M
What: Test labeled "Unit" but not mocking dependencies
Detection:
Severity: LOW
Recommendation: Either mock dependencies OR rename to Integration test
Effort: S
What: Only testing success cases, ignoring errors
Detection:
Severity: MEDIUM
Recommendation: Add negative tests (error handling, edge cases)
Effort: M
Example:
login() with valid credentials, ignores error scenarioslogin() with invalid credentials throws 'Invalid credentials' errorWhat: Tests validating Express/Prisma/bcrypt (NOT our code)
Detection:
Severity: MEDIUM
Recommendation: Delete framework tests
Effort: S
isolation_issues = sum of all isolation violations
determinism_issues = sum of all determinism violations
anti_patterns = sum of all anti-pattern counts
penalty = (isolation_issues * 0.5) + (determinism_issues * 0.5) + (anti_patterns * 0.3)
score = max(0, 10 - penalty)
{
"category": "Isolation & Anti-Patterns",
"score": 6,
"total_issues": 18,
"isolation_issues": 8,
"determinism_issues": 4,
"anti_patterns": 6,
"findings": {
"isolation": [
{
"severity": "HIGH",
"issue": "External API not mocked",
"test_file": "user.test.ts",
"location": "user.test.ts:45-52",
"description": "Test makes real HTTP call to https://api.github.com",
"recommendation": "Mock external API with nock or jest.mock",
"effort": "M"
},
{
"severity": "MEDIUM",
"issue": "Real database used in tests",
"test_file": "db.test.ts",
"location": "db.test.ts:12",
"description": "Test connects to localhost:5432 PostgreSQL",
"recommendation": "Use in-memory SQLite (:memory:) or mock DB",
"effort": "L"
}
],
"determinism": [
{
"severity": "HIGH",
"issue": "Flaky test (race condition)",
"test_file": "async.test.ts",
"location": "async.test.ts:28-35",
"description": "setTimeout without proper await",
"recommendation": "Fix race condition with proper async/await",
"effort": "M"
}
],
"anti_patterns": [
{
"anti_pattern": "The Liar",
"count": 3,
"examples": [
"user.test.ts:45 - 'createUser works' (no assertions)",
"auth.test.ts:12 - 'login works' (only toBeTruthy())"
],
"recommendation": "Add specific assertions or delete tests",
"effort": "S"
},
{
"anti_pattern": "The Giant",
"count": 2,
"examples": [
"order.test.ts:200-350 - 'order flow' (150 lines)"
],
"recommendation": "Split into focused tests (one scenario per test)",
"effort": "M"
},
{
"anti_pattern": "Happy Path Only",
"count": 5,
"examples": [
"payment.test.ts - only success scenarios, no error tests"
],
"recommendation": "Add negative tests for error handling",
"effort": "M"
}
]
}
}
Version: 3.0.0 Last Updated: 2025-12-23
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience