Skip to content

Conversation

@roger-zhangg
Copy link
Member

Problem

The existing test guidelines in docs/CODE_GUIDELINES.md were minimal and didn't cover common testing patterns and anti-patterns discovered during test reviews.

Solution

Expanded the "Test guidelines" section in docs/CODE_GUIDELINES.md with practical guidance on:

  • Real filesystem operations: Use TestFolder and testFixtures instead of stubbing fs methods
  • Module imports: Import at top level instead of dynamic require() for stubbing
  • Minimum mocks: Table showing what to mock vs. what not to mock
  • Dependency injection: Design modules to accept context objects for testability
  • URI methods: Use vscode.Uri.file() for filesystem paths
  • PrompterTester: How to test wizard flows with QuickPicks and InputBoxes
  • API parameter verification: Reference to mocked server pattern for verifying request payloads

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@roger-zhangg roger-zhangg requested a review from a team as a code owner January 21, 2026 22:00
@roger-zhangg roger-zhangg changed the title doc(test): expand test guidelines with best practices for mocking, filesystem, and wizard testing docs(test): expand test guidelines with best practices for mocking, filesystem, and wizard testing Jan 21, 2026
@roger-zhangg roger-zhangg reopened this Jan 22, 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