diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 5cf9dac..50e4f7e 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -364,5 +364,24 @@ export default defineConfig({ } }, cleanUrls: false, + // `docs/old/` is a scratch archive of superseded planning notes. It is + // gitignored (.gitignore:9) and untracked, so `actions/checkout` never + // materialises it and the PUBLISHED site has never contained those pages — + // this exclusion is therefore not a fix to what ships. + // + // What it does fix is the local-vs-CI divergence. On a developer checkout the + // two files are present, VitePress happily builds them, and every locally + // measured figure silently disagrees with CI: 159 pages locally vs 157 in a + // clean checkout, with the anchor gate's link corpus inflated to match. That + // gap has already cost review time, because a local corpus number cannot be + // compared against the CI one. Excluding the directory makes a local + // `npm run docs:build` produce the same corpus CI does. + // + // Scoped deliberately to `old/**` only. `archive/` sits at the repository + // root, outside VitePress's `docs` srcDir, so it is already unreachable by + // the build and needs no exclusion. No live page links into `old/**` + // (verified against both the markdown source and the emitted HTML), so + // excluding it creates no dead links for the anchor gate to trip over. + srcExclude: ['old/**'], ignoreDeadLinks: false }) diff --git a/tests/config.import.test.ts b/tests/config.import.test.ts index 77ae0ae..75d588d 100644 --- a/tests/config.import.test.ts +++ b/tests/config.import.test.ts @@ -88,6 +88,16 @@ describe('Config Module Loading', () => { expect(configModule.default.ignoreDeadLinks).toBe(false) }) + // Asserted against the RESOLVED export, not the file text. A + // `configContent.toContain('srcExclude')` check would also be satisfied by + // the explanatory comment sitting directly above the option, so it could not + // tell a live setting apart from a description of one. + it('should exclude docs/old from the build via srcExclude', async () => { + const configModule = await import('../docs/.vitepress/config.ts') + expect(configModule.default).toHaveProperty('srcExclude') + expect(configModule.default.srcExclude).toEqual(['old/**']) + }) + it('should have dark mode enabled', async () => { const configModule = await import('../docs/.vitepress/config.ts') expect(configModule.default.themeConfig).toHaveProperty('darkModeSwitch')