Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP2universalStack: testing
project-structuretestingconventions
Keep test-only helpers in a test directory
Test utilities must not sit next to production source where they read as app code; place them under test/ (or a __tests__/ folder co-located with their specs).
PR: FCK-3307 Improve the order of <head> elementsCreated: Jul 16, 2026
Bad example
Old codets
| 1 | // views/renderTemplate.ts (next to production templates) |
| 2 | export async function renderTemplate(template: string) { /* test-only */ } |
Explanation (EN)
A helper only used by specs looks like production code when placed in a source directory.
Objašnjenje (HR)
Helper koji koriste samo specovi izgleda kao produkcijski kod kad stoji u source direktoriju.
Good example
New codets
| 1 | // test/template-utils.ts |
| 2 | export async function renderTemplate(template: string) { /* test-only */ } |
Explanation (EN)
The location itself now communicates that this is testing infrastructure.
Objašnjenje (HR)
Sama lokacija sada jasno komunicira da je ovo test infrastruktura.