-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Problem
jest.config.ts was updated to add diagnostics: false to the ts-jest transform config as a workaround for a pre-existing type error in src/bin/cli.ts. This silently disables TypeScript type checking across the entire test suite — type errors in test files won't be surfaced by pnpm test.
Root cause
src/bin/cli.ts passes 0 (integer) as the third element of the maxSvgColors command tuple:
[
Commands.maxSvgColors,
'Max colors for SVG conversion of simple images (default: 16). Requires --optimize.',
0,
]The args library types expect string | boolean | undefined for the default value, so 0 is a type error. ts-jest caught this and refused to compile, blocking the test suite.
Fix
Change the default from 0 to undefined (or omit it entirely) in the commands array, and update the maxSvgColors flag resolution in run() accordingly:
// In commands array — omit the default or use undefined
[
Commands.maxSvgColors,
'Max colors for SVG conversion of simple images (default: 16). Requires --optimize.',
],
// Flag resolution already handles missing/zero correctly:
const maxSvgColors = typeof flags.maxSvgColors === 'number' && flags.maxSvgColors > 0
? flags.maxSvgColors
: undefinedOnce the type error is fixed, remove diagnostics: false and strict: false from jest.config.ts to restore full type checking.
Files
src/bin/cli.ts— fix the0defaultjest.config.ts— removediagnostics: falseandstrict: false