Skip to content

Improve doctor.mjs test suite based on review feedback#69

Merged
JustAGhosT merged 3 commits intoadd-doctor-tests-10176394997023626905from
copilot/sub-pr-59
Feb 28, 2026
Merged

Improve doctor.mjs test suite based on review feedback#69
JustAGhosT merged 3 commits intoadd-doctor-tests-10176394997023626905from
copilot/sub-pr-59

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

The original doctor.test.mjs had structural issues: repeated await import() calls per-test, incorrect test naming, informal comments, missing coverage for several code paths, and no tests for the verbose flag.

Changes

Mock setup refactored

  • validateSpec imported at top level; default mock set in beforeEach instead of per-test dynamic imports
  • vi.mock('fs') retained — required in ESM to make named exports configurable for vi.spyOn

Test quality fixes

  • Renamed test: "should report error if overlay settings file is missing""should report warning ..." (matches actual behavior)
  • Removed informal/uncertain inline comment

New coverage

  • Unknown render targets are silently ignored (no spurious findings)
  • Success path when all configured template roots exist
  • project.yaml invalid YAML triggers error finding (previously untested catch block)
  • project.yaml completeness test now asserts both the info percentage finding and the Top missing high-impact fields warning

Verbose flag tests (3 new)

  • Asserts flags.verbose prints suggested next actions for each status (FAIL, WARN, PASS)

Refactor

  • Extracted getConsoleOutput() helper to eliminate duplication across verbose tests
  • Renamed findingWithUnknownTargetunknownTargetFinding

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: JustAGhosT <5531814+JustAGhosT@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tests for doctor.mjs to improve code coverage Improve doctor.mjs test suite based on review feedback Feb 27, 2026
@JustAGhosT JustAGhosT marked this pull request as ready for review February 28, 2026 07:29
@JustAGhosT JustAGhosT merged commit c751fb7 into add-doctor-tests-10176394997023626905 Feb 28, 2026
@JustAGhosT JustAGhosT deleted the copilot/sub-pr-59 branch February 28, 2026 07:30
JustAGhosT added a commit that referenced this pull request Apr 1, 2026
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.

2 participants