镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Tests] Cover DoctorSuite filesystem assertions - #8748

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
tests-maintenance-37247687073
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
tests-maintenance-37247687073

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

DoctorSuite is the base class that release-verification suites (ThemeInitTests, ThemePushTests) extend to assert on files produced by CLI commands. Its three filesystem assertions — assertFile, assertNoFile, and assertDirectory — had no test coverage at all, so regressions in path resolution, content matching, or pass/fail polarity would land silently and surface as wrong doctor results rather than a failing build.

The gap was held open by the test file itself: framework.test.ts auto-mocked ../fs.js without ever configuring the mock, which made every filesystem assertion unobservable and effectively untestable.

The seven-day review of Main tests runs (2026-09-28 to 2026-10-05 UTC, 29 runs, 9 failed jobs) found no actionable flake left to fix: all nine failures were version.test.ts subprocess timeouts and a node-package-manager cache assertion, both already fixed on main by #8669, plus one conf-store rate-limit failure on stable/4.8 already fixed by #8705. With no remaining flake, this closes the coverage gap instead.

WHAT is this pull request doing?

Removes the unused vi.mock('../fs.js') and covers the three filesystem assertions against real files in temporary directories:

  • assertFile with no pattern, a matching RegExp, a matching string, and a non-matching string
  • assertFile on a missing file, confirming it reports file not found and never reads content
  • assertFile with an absolute path and a custom message
  • assertNoFile and assertDirectory for both the present and absent cases

Each test writes its own fixtures inside inTemporaryDirectory and asserts on the recorded description/passed/actual contract rather than on internal calls, so the assertions stay refactorable. No production code changed, and the existing vi.mock('../system.js') is kept since command execution is out of scope here.

Validation: the suite was sanity-checked by temporarily inverting assertNoFile's passed flag and dropping the isAbsolutePath branch in assertFile — two of the new tests failed, and both pass again once reverted. pnpm vitest run packages/cli-kit/src/public/node/doctor/ passes 25 tests (up from 17), including with --sequence.shuffle, alongside ESLint and tsc --noEmit on cli-kit. Verified locally on Linux / Node 22; the OS and Node matrix is left to CI.

How to manually test your changes?

CI

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

The DoctorSuite filesystem assertions had no coverage, and the test file
auto-mocked ../fs.js, which is what made them untestable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Suleimanlatrsh Suleimanlatrsh mentioned this pull request Oct 5, 2026
1 of 4 tasks

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants