chore(vscode): move tests to central temp dir creation#5054
Conversation
benfdking
commented
Jul 29, 2025
- cleans up tem dir after every test
- cleans up tem dir after every test
af42dfa to
5e328e8
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR centralizes temporary directory creation for VSCode extension tests by moving it to a reusable fixture. This eliminates code duplication across test files where each test was creating its own temporary directory, and ensures automatic cleanup after each test completes.
- Moves temp directory creation from individual tests to a central
tempDirfixture infixtures.ts - Updates all test files to use the new
tempDirparameter instead of creating directories manually - Adds automatic cleanup of temporary directories after each test
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| vscode/extension/tests/fixtures.ts | Adds centralized tempDir fixture with automatic creation and cleanup |
| vscode/extension/tests/*.spec.ts | Updates test functions to accept tempDir parameter instead of creating directories manually |
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-expect-error | ||
| { auto: true }, |
There was a problem hiding this comment.
Using @ts-expect-error to suppress TypeScript errors is not a good practice. Consider fixing the underlying type issue or using a more specific type annotation instead of suppressing the error.
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
| // @ts-expect-error | |
| { auto: true }, | |
| { auto: true as boolean }, |
| async function setupEnvironment(): Promise<{ | ||
| tempDir: string | ||
| async function setupEnvironment(tempDir: string): Promise<{ | ||
| pythonDetails: PythonEnvironment |
There was a problem hiding this comment.
The function signature change removes the return of tempDir but the return type still includes it in the destructuring pattern. This creates an inconsistency between what the function returns and what callers expect.
| pythonDetails: PythonEnvironment | |
| pythonDetails: PythonEnvironment; |