Skip to content

Commit a5e6d28

Browse files
authored
Merge branch 'main' into confused-aardvark
2 parents 5071ff8 + 4b5bdd2 commit a5e6d28

File tree

9 files changed

+940
-51
lines changed

9 files changed

+940
-51
lines changed

.github/instructions/testing-workflow.instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,6 @@ envConfig.inspect
574574
- Untestable Node.js APIs → Create proxy abstraction functions (use function overloads to preserve intelligent typing while making functions mockable)
575575

576576
## 🧠 Agent Learnings
577-
578577
- VS Code file watchers only monitor workspace folders, not external temp directories (1)
579578
- Use fixture-based testing with real files instead of mocking fs-extra, which has non-configurable property descriptors that prevent stubbing (1)
580579
- Extension tests (.test.ts) should use real filesystem operations; unit tests (.unit.test.ts) should mock dependencies (1)
@@ -587,3 +586,5 @@ envConfig.inspect
587586
- Check for redundant test coverage between unit and integration test files - integration tests should test end-to-end behavior while unit tests focus on internal logic and edge cases (1)
588587
- For async test timing, prefer event-driven or promise-based approaches over delays; when testing fire-and-forget event handlers with no completion signal, use condition-based polling (`waitForCondition`) instead of hardcoded `setTimeout` - faster and more reliable than arbitrary delays (1)
589588
- When accessing fixture files in compiled tests, use `path.join(__dirname, '..', '..', '..', 'src', 'test', 'fixtures')` to read directly from source instead of copying to `out/` - `__dirname` points to the compiled location so navigate up and into `src/` (1)
589+
- Avoid testing exact error messages or log output - assert only that errors are thrown or rejection occurs to prevent brittle tests (1)
590+
- Create shared mock helpers (e.g., `createMockLogOutputChannel()`) instead of duplicating mock setup across multiple test files (1)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-python-envs",
33
"displayName": "Python Environments",
44
"description": "Provides a unified python environment experience",
5-
"version": "1.14.0",
5+
"version": "1.15.0",
66
"publisher": "ms-python",
77
"preview": true,
88
"engines": {

src/test/features/envCommands.unit.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as assert from 'assert';
2-
import * as typeMoq from 'typemoq';
32
import * as sinon from 'sinon';
4-
import { EnvironmentManagers, InternalEnvironmentManager, PythonProjectManager } from '../../internal.api';
5-
import * as projectApi from '../../common/pickers/projects';
6-
import * as managerApi from '../../common/pickers/managers';
3+
import * as typeMoq from 'typemoq';
4+
import { Uri } from 'vscode';
75
import { PythonEnvironment, PythonProject } from '../../api';
6+
import * as managerApi from '../../common/pickers/managers';
7+
import * as projectApi from '../../common/pickers/projects';
88
import { createAnyEnvironmentCommand } from '../../features/envCommands';
9-
import { Uri } from 'vscode';
9+
import { EnvironmentManagers, InternalEnvironmentManager, PythonProjectManager } from '../../internal.api';
10+
import { setupNonThenable } from '../mocks/helper';
1011

1112
suite('Create Any Environment Command Tests', () => {
1213
let em: typeMoq.IMock<EnvironmentManagers>;
@@ -37,8 +38,7 @@ suite('Create Any Environment Command Tests', () => {
3738

3839
env = typeMoq.Mock.ofType<PythonEnvironment>();
3940
env.setup((e) => e.envId).returns(() => ({ id: 'env1', managerId: 'test' }));
40-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
41-
env.setup((e: any) => e.then).returns(() => undefined);
41+
setupNonThenable(env);
4242

4343
em = typeMoq.Mock.ofType<EnvironmentManagers>();
4444
em.setup((e) => e.managers).returns(() => [manager.object]);

0 commit comments

Comments
 (0)