test: add comprehensive test coverage + fetch timeout + CLI help/version#2
Open
dmchaledev wants to merge 1 commit into
Open
test: add comprehensive test coverage + fetch timeout + CLI help/version#2dmchaledev wants to merge 1 commit into
dmchaledev wants to merge 1 commit into
Conversation
- Add 44 new tests covering all rule functions (checkPermissionsPolicy, checkCrossOriginPolicies, checkXFrameOptions edge cases, grade boundaries) - Branch coverage improved from 73.7% → 96.1% - rules.ts and analyzer.ts now at 100% statement coverage - Add configurable timeout to fetchHeaders (default 10s) with AbortController - Add --help and --version flags to CLI - Add --timeout option to CLI for configurable fetch timeout - Export FetchOptions type from index.ts - Export FetchOptions type for library consumers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves test coverage, adds fetch timeout support, and enhances the CLI with
--help,--version, and--timeoutflags.Changes
New tests (44 added, 15 → 59 total):
checkPermissionsPolicycheckCrossOriginPoliciescheckXFrameOptions(invalid values, CSP frame-ancestors fallback)checkReferrerPolicy(all strong/weak values)analyze()convenience function (async path)Coverage improvements:
rules.ts: 93.3% → 100% statement coverageanalyzer.ts: 100% across all metricsNew features:
fetchHeaders(url, { timeoutMs? })— configurable timeout withAbortController(default 10s)--help/-hflag with usage documentation--version/-vflag--timeout <ms>flagFetchOptionstype from index.tsTesting
npm run typecheck— passesnpm test— 59/59 tests passnpm run build— passes