Repository navigation
test: cover add-frontmatter.mjs main() catch block and empty-frontmatter branch - #402
Conversation
…ter branch - Mocks the glob dependency to deterministically exercise main()'s top-level try/catch, which was previously unreachable because glob() never rejects for missing/unreadable directories. - Adds a fixture for frontmatter that exists but is empty, covering the falsy side of the frontmatterWithoutTitle ternary. - Requires node's --experimental-test-module-mocks flag (added to test:unit) for mock.module() support. scripts/add-frontmatter.mjs and lib/ now report 100% statement/branch/ function/line coverage under c8 (was 97%/90.9%/100%/97% for scripts/, 100%/100%/100%/100% for lib/). Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
✅ Deploy Preview for cncf-techdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
20aae69
ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blockedHive flagged this PR (author @hivecommons-hive[bot], head
Hive did not add the |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Reviewed by Reviewer notesRead the script and ran the suite locally — this looks correct to me. Verified against the tree at head
Ran No findings. The PR carries a |
package.json's test:coverage script (added in #397) reported coverage but never failed the build on regression: c8's defaults are 0% for branches/functions/statements and 90% for lines. #396 deliberately deferred adding thresholds until in-flight coverage PRs merged, to avoid landing the gate red. lib/ is now 100% across all four metrics (after #389/#392/#394/#401). Only scripts/add-frontmatter.mjs remains below 100% branch coverage, tracked by the still-open #402. Set thresholds at the currently achieved levels (99/99/97/100) so the gate passes today and catches any future regression; it can be tightened to --100 once #402 merges. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
|
Co-authored-by: nate-double-u <4453979+nate-double-u@users.noreply.github.com>
Head branch was pushed to by a user without write access
Test Improvement
scripts/add-frontmatter.mjswas at 97% statements / 90.9% branch coverage(lines 95-97, the main() catch block for an unrejected
glob()call, andline 60's falsy ternary branch for empty-but-present frontmatter). Both are
now covered:
globdependency vianode:test'smock.module()todeterministically force main()'s own top-level try/catch, which is
otherwise unreachable:
glob()never rejects for missing or unreadabledirectories, so this branch could only be exercised by mocking the
dependency, not by fixture files on disk.
other keys), covering the falsy side of the
frontmatterWithoutTitle ? ... : ''ternary.package.json'stest:unitscript gains the--experimental-test-module-mocksNode flag, required formock.module(); no other script or production code changed.npm run test:coveragenow reports 100% statements/branches/functions/linesacross both
lib/andscripts/(previously 100% forlib/, 97%/90.9%for
scripts/add-frontmatter.mjs).Related Issue
N/A — found and fixed directly while re-verifying coverage after #401 merged.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88