Skip to content

Commit e29a884

Browse files
jdaltonclaude
andcommitted
Improve parse-args.ts test coverage to 100%
Add test for coerce option functionality. This improves parse-args.ts statement coverage from 97.56% to 100%. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3b26934 commit e29a884

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/registry/parse-args.test.mts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,20 @@ describe('parse-args module', () => {
326326
expect(result.values['quiet']).toBe(true)
327327
})
328328
})
329+
330+
describe('coerce option', () => {
331+
it('should apply coerce function to option values', () => {
332+
const result = parseArgs({
333+
args: ['--port', '8080'],
334+
options: {
335+
port: {
336+
type: 'string',
337+
coerce: (value: string) => Number.parseInt(value, 10),
338+
},
339+
},
340+
})
341+
expect(result.values['port']).toBe(8080)
342+
expect(typeof result.values['port']).toBe('number')
343+
})
344+
})
329345
})

0 commit comments

Comments
 (0)