Repository navigation
test: cover isProd-dependent url/editUrl branches in docusaurus.config.ts - #413
Conversation
…g.ts docusaurus.config.ts is excluded from the c8 coverage gate, and the existing lib/docusaurusConfigPreprocessor.test.mts only exercises the markdown.preprocessor function. Its three isProd-dependent fields (top-level url, docs preset editUrl, analyses plugin editUrl) had no unit assertion at all. Adds a test-only harness (lib/testHelpers/printConfigBuildUrls.mjs, following the resolveExtensionlessTs.mjs pattern already used to import docusaurus.config.ts directly in tests) that spawns a fresh process per env combination, since getBuildContext() is evaluated once at module load time. Verified the new test actually detects a regression: a manual mutation inverting the isProd check (reverted before commit) made the localhost-fallback test fail with the wrong URL. No production code changed. 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. |
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Reviewed by Reviewer notesVerified locally — looks correct to me. (I cannot approve; a maintainer's signature is needed.) What I checked against the tree at
No findings. No production code touched; disjoint from #408/#410/#411/#412 as the body claims. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the URL-configuration regression tests or their test-only harness.
No open issues 🎉
What changed in this PR
Adds regression tests for the production-dependent URL settings in docusaurus.config.ts, complementing the existing markdown preprocessor tests without changing production code.
Changes:
- Tests production URLs and edit links, deploy-preview URLs without edit links, and the localhost fallback.
- Adds a test-only harness that loads the configuration in a fresh child process for each environment combination.
| File | Description |
|---|---|
lib/testHelpers/printConfigBuildUrls.mjs |
Loads the configuration and prints its site and edit URLs as JSON. |
lib/docusaurusConfigBuildContext.test.mts |
Asserts URL behavior for production, deploy-preview, and development environments. |
Review effort: Balanced
Test Improvement
Adds
lib/docusaurusConfigBuildContext.test.mtsplus a test-only harnesslib/testHelpers/printConfigBuildUrls.mjs(same extensionless-importpattern as
lib/testHelpers/resolveExtensionlessTs.mjs) that importsdocusaurus.config.tsin a fresh child process per env combination —necessary because
getBuildContext()runs once at module load time.Covers the three
isProd-dependent fields indocusaurus.config.tsthathad zero unit assertions: the top-level
url, the docs preset'seditUrl, and the analyses plugin'seditUrl. This file is excludedfrom the
test:coveragec8 gate, and the only existing test for it(
lib/docusaurusConfigPreprocessor.test.mts) only exercisesmarkdown.preprocessor— it never touches these fields.This is disjoint from #408 (fixes the TS2339 typecheck regression in
docusaurusConfigPreprocessor.test.mts), #410 (adds a reference-linktest case to that same file), #411 (tightens
test:coveragethresholds),and #412 (covers
resolveExtensionlessTs.mjs's own resolution branches):none of those add any assertion on
config.url/config.*.editUrl, andthis PR doesn't touch any file those PRs touch.
Verified:
npx prettier --checkandnpx tsc --noEmitboth pass (theonly
tscerror is the pre-existing, unrelated TS2339 regression alreadyfixed by #408). Manually inverted the
isProdcheck indocusaurus.config.ts(reverted before commit) and confirmed the newlocalhost-fallback test fails with the wrong URL, so the assertions
actually detect regressions. No production code changed.
Related Issue
Refs #407 (needs-human: no — this finding was auto-folded into #407's
component tracker by the hive's dedup logic since it also touches the
docusaurus.config.tstest cluster, but it is a distinct, disjointsub-finding about three previously-unasserted isProd branches, not the
typecheck regression #407/#408 already fix. Leaving #407 open since it
still tracks that unrelated typecheck fix.)
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88