scan-json-togglesunchanged
Asserts — What output.* toggles do to –format json: today, nothing (#91). The payload below is emitted with every section switched off, yet still carries packages, components, versus and ruleViolations in full. Pair it with scan-human-minimal to see the two formats diverge; when #91 lands, this baseline shrinking is the proof.
Ran hermex scan --format json --config configs/minimal.config.ts in fixtures/ → exit 0, as asserted
Config fixtures/configs/minimal.config.ts · Fixture fixtures (overview) · Case scan-json-toggles (dossier)
Reproduce locally: pnpm run test:output -- --filter scan-json-toggles
fixtures/configs/minimal.config.ts
import type { HermexConfigInput } from '../../src/config/types.ts';
import base from '../hermex.config.ts';
/**
* Every output section off except the summary. Regression cover for #63:
* a section that is switched off must actually be absent, not rendered
* empty or rendered anyway. Used twice — once as human output, once as
* `--format json`, since the JSON payload has to honour the same toggles.
*/
export default {
...base,
output: {
summary: 'log',
packages: false,
components: false,
patterns: false,
details: false,
versus: false,
rules: false,
},
} satisfies HermexConfigInput;
stdout.json{
"version": "<version>",
"summary": {
"filesAnalyzed": 17,
"totalImports": 80,
"totalComponents": 35,
"totalUsagePatterns": 284
},
"ruleViolations": [
{
"ruleId": "no-packages",
"severity": "error",
"patterns": [
"moment"
],
"message": "Use date-fns or dayjs",
"matchedFiles": [],
"packageName": "moment"
},
{
"ruleId": "require-packages",
"severity": "error",
"patterns": [
"typescript"
],
"message": "TypeScript is required",
"matchedFiles": []
},
{
"ruleId": "require-files",
"severity": "error",
"patterns": [
".nvmrc"
],
"matchedFiles": []
},
{
"ruleId": "require-files",
"severity": "warn",
"patterns": [
".editorconfig"
],
"matchedFiles": []
}
],
"compliance": {
"status": "non-compliant",
"compliant": false,
"counts": {
"errorRuleViolations": 3,
"releaseAgeViolations": 0,
"warningRuleViolations": 1
}
}
}
stderr.txthermex v<version>
- Parsing lockfile...
✔ Found pnpm lockfile (supports: v5, v6, v9) - 5 packages
✔ Found 18 files
✔ Analysis complete! Analyzed 17/18 files
⚠ 1 file(s) failed to parse:
broken/unparseable.tsx
x Expression expected
,----
1 | export const Broken = ( : : :;
: ^
`----
Caused by:
Syntax Error