Migrates 'context option list' to Zod. Closes #6910#7222
Migrates 'context option list' to Zod. Closes #6910#7222milanholemans merged 3 commits intopnp:mainfrom
Conversation
waldekmastykarz
left a comment
There was a problem hiding this comment.
PR Review Summary
PR: #7222 - Migrates 'context option list' to Zod
Author: @MartinM85
Overview
Clean Zod migration. The schema, getter, export, and test updates all follow the expected pattern. One minor inconsistency found.
Findings
- [Warning]
option-list.spec.ts(line 75) — Thehandles an error when reading file content failstest still passes raw{ options: { debug: true } }instead of usingcommandOptionsSchema.parse({ debug: true }). The other twocommand.action()calls were updated but this one was missed.
await assert.rejects(command.action(logger, { options: commandOptionsSchema.parse({ debug: true }) }), new CommandError(`Error reading .m365rc.json: Error: An error has occurred. Please retrieve context options from .m365rc.json manually.`));
Checklist Coverage
Verified: single quotes, async/await, no any types in new code, no commented-out code, no PII in telemetry, logger patterns, Zod schema structure. Documentation items not applicable (no new command or behavior change).
Reviewed against the PR checklist.
There was a problem hiding this comment.
Pull request overview
Migrates the m365 context option list command to the repository’s Zod-based option validation approach as part of the broader CLI validation refactor (closes #6910).
Changes:
- Added a Zod schema for
context option listbased onglobalOptionsZod. - Updated unit tests to use the command’s parsed/refined Zod schema via
getSchemaToParse()and validate unknown options.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/m365/context/commands/option/option-list.ts | Introduces a Zod options schema and exposes it via the command’s schema getter. |
| src/m365/context/commands/option/option-list.spec.ts | Updates tests to validate/parse options using the Zod schema and adds basic schema validation tests. |
Closes #6910