test: add validateOptions function parameter validation tests (#461)#469
test: add validateOptions function parameter validation tests (#461)#469anzjj wants to merge 1 commit into
Conversation
sonukapoor
left a comment
There was a problem hiding this comment.
Welcome, and thanks for picking this up - test coverage for validateOptions is exactly what was needed, and the scenarios you've chosen map cleanly to every validation rule in the function. A few things to fix before this is ready:
- Comments throughout the file are in Chinese - please translate them to English to be consistent with the rest of the codebase.
- The file is missing a newline at the end.
- The branch is behind main - please rebase against
origin/mainbefore we merge.
| @@ -0,0 +1,120 @@ | |||
| // @ts-nocheck // 临时忽略tsconfig的rootDir报错(可选) | |||
| import { describe, it, expect } from '@jest/globals'; | |||
There was a problem hiding this comment.
Please remove @ts-nocheck - it disables type checking for the entire file. The root cause is that defaultOptions is missing two required fields from ParsedOptions: failOn and batchSize. Add those to the object (e.g. failOn: 'critical', batchSize: '100') and the TypeScript error should resolve without needing to suppress it.
|
Hey @anzjj, thanks for the contribution! It turns out PR #464 covers the same ground and was already open when this was submitted — it also adds |
Description
Closes #461 - Add parameter validation tests for the
validateOptionsfunctionChanges
--offlinewith--osv-url,--no-cachewith--offline, etc.defaultOptionsTest Results
Notes
No breaking changes. Only test code is added, and it will not affect existing features.