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).
backend ruleP1universalStack: node
testingenvironmentfixturesflakiness
Make test fixtures match the environment-dependent config they run under
Test data must use values valid for the environment the tests actually run in (e.g. dev categories under NODE_ENV=test), or stub the env, instead of hardcoding production-only values.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // NODE_ENV is 'test', so prod category 859 is rejected -> flaky |
| 2 | const mocks = (categoryId = 859) => { /* ... */ }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // use a dev-valid id, or mock getCurrentRunningEnv() |
| 2 | const mocks = (categoryId = 828) => { /* ... */ }; |
Explanation (EN)
Objašnjenje (HR)