Repository navigation
test(cli): the docs-scan case reads the scan's walk, not every doc - #10060
Conversation
import-hint-correctness's "builds its fixture where a scan of the repo's docs running at the same time never finds it" called collectDocs() only to read the scanned file list, so it imported all 1,482 doc files under the test runner. Earlier cases used to leave many of them loaded. Once they no longer did, the case took 2.9 s alone and over 30 s in a loaded full run. docs-drift.mjs now exports docFiles(), the walk collectDocs() imports from, and the case asserts on it, with a known doc as a positive control. It imports no doc.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The docs-scan case now reads the scan's own walk through docFiles() instead of importing every doc, and the new positive control keeps an empty walk from passing. collectDocs() and the drift gate behave as before, and both changed test files pass.
Next: mark the pull request ready for review and have a maintainer add the ci:run label so CI runs.
[Automated review]
Maintainer impact
import-hint-correctness.test.mjs's "builds its fixture where a scan of the repo's docs running at the same time never finds it" times out onmainin loaded full runs of the node suite. It calledcollectDocs()fromtest/drift/docs-drift.mjsonly to read which files the scan lists, so it imported all 1,482*.doc.mjsfiles under the test runner. Earlier cases in the file used to leave many of them loaded. Since #10008 gatedissues()'s template read, they no longer do, and the case went from about 0.8 s to 2.9 s alone, and past 30 s in a full run.Intended invariant
The case still proves the docs scan never finds the fixture: it reads the same walk the scan imports from, and checks that the walk lists a known doc.
Change
test/drift/docs-drift.mjs:docFiles()returns the walk, andcollectDocs()imports from it as before.clients/cli/commands/import-hint-correctness.test.mjs: the case asserts ondocFiles(), withcomponent.doc.mjsas a positive control, and imports no doc.Evidence
main: in fullvitest run --project noderuns, the case times out at 30 s (twice at e657e2e, and once on another lane's tree). With this change it passes in 306 ms in a full run.mainand 0.8–1.0 s here.mainat its 30 s limit both times, and passes here in 1.8–1.9 s.Scope
Testing
At 6365a21 on
mainbfc1dcc:vitest run --project node: 16,712 tests passed, at 398dc4d, which differs only in where one JSDoc line sits.import-hint-correctness.test.mjsanddocs-drift.test.mjs: 550 tests passed at 6365a21.eslint(CI=true) andpnpm lintpass (docs-drift.mjsis lint-ignored), the CLI'spnpm typecheckpasses, andpnpm review:prereports 0 findings.