test-support-in-src
Where shared test helpers, mocks and fixtures live.
Deterministic checkAdvises by default
The rule
Agents read this text as written when they write and review code.
Keep shared test helpers, mocks and fixtures out of src/, in the package's tests/ folder: tests/helpers/, tests/mocks/, tests/fixtures/. Only test files sit beside their source.
- A mock or helper one test file uses stays in that file.
- One that several test files share goes in
tests/.
Under src/, test-support code reads as production source, to scanners and people alike.
Examples
The check flags the incorrect code and passes the correct code. Each example is a small repo, because this rule looks across files. It opens on the file that matters; the other files are the repo around it.
Incorrect
srcfeaturefixtures
export const sampleLabel = 'Ada';
Correct
srcfeaturetestsfixtures
export const getLabel = ({ name }: { name: string }): string => name.trim();
Configure
- Block
"blocking"Stops a run when a file the run changed breaks the rule. - AdviseDefault
"advisory"Reports it and hands it to the refactor agent. Never stops a run. - Off
"off"Not checked. Use it when your own linter already enforces the rule.
Add this to your lightsout.config.json, then change the value.
{"standards-rule-settings": {"test-support-in-src": "advisory"}}