lightsoutAlpha

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
src/feature/fixtures/sampleLabel.ts
export const sampleLabel = 'Ada';

Correct

srcfeaturetestsfixtures
src/feature/getLabel.ts
export const getLabel = ({ name }: { name: string }): string => name.trim();

Configure

  • Block"blocking"Stops a run when a file the run changed breaks the rule.
  • Advise"advisory"Reports it and hands it to the refactor agent. Never stops a run.
    Default
  • 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.

lightsout.config.json
{
"standards-rule-settings": {
"test-support-in-src": "advisory"
}
}

Packs that select it