Skip to content

Conversation

@LivingG0D
Copy link

This pull request updates the test suite for path utilities to improve the reliability and clarity of workspace path handling in VS Code extension tests. The main changes involve refactoring the mocking strategy for the vscode module and expanding test coverage for the getWorkspacePath utility.

Test infrastructure improvements:

  • Refactored the mocking of the vscode module to use vi.hoisted and a shared mockState object, enabling dynamic updates to the mock state and ensuring consistent behavior across tests. (src/utils/__tests__/path.spec.ts)
  • Added logic to reset the mockState after each test, preventing test state leakage and improving isolation. (src/utils/__tests__/path.spec.ts)

Expanded test coverage:

  • Added new test cases for getWorkspacePath to verify behavior when there is no active editor, no workspace folders, and when falling back to the default path. (src/utils/__tests__/path.spec.ts)
  • Updated existing test to expect the correct workspace folder path based on the mocked VS Code environment. (src/utils/__tests__/path.spec.ts)…al test cases for workspace path retrieval
  • Sign in with a user with tracks
  • Activate show_awesome_cat_gifs feature (add ?feature.show_awesome_cat_gifs=1 to your URL)
  • You should see a GIF with cats dancing

Copilot AI review requested due to automatic review settings December 4, 2025 21:01
@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

⚠️ No Changeset found

Latest commit: a3be3aa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot finished reviewing on behalf of LivingG0D December 4, 2025 21:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the path utility test suite to improve mock state management and expand test coverage for the getWorkspacePath function. The changes introduce a more flexible mocking approach using vi.hoisted that allows tests to dynamically update mock state between test cases.

Key changes:

  • Refactored VS Code module mocking to use vi.hoisted with a shared mockState object and getter functions for dynamic state updates
  • Added afterEach hook to reset mock state between tests, preventing state leakage
  • Expanded getWorkspacePath test coverage with three test cases covering different workspace scenarios
Comments suppressed due to low confidence (1)

src/utils/tests/path.spec.ts:5

  • Unused import vscode.
import * as vscode from "vscode"

@LivingG0D
Copy link
Author

@copilot open a new pull request to apply changes based on the comments in this thread

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.

1 participant