You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/instructions/testing-workflow.instructions.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -537,17 +537,16 @@ envConfig.inspect
537
537
- ❌ Tests that don't clean up mocks properly
538
538
- ❌ Overly complex test setup that's hard to understand
539
539
540
-
## 🧠 Agent Learning Patterns
541
-
542
-
### Key Implementation Insights
540
+
## 🧠 Agent Learnings
543
541
544
542
- Always use dynamic path construction with Node.js `path` module when testing functions that resolve paths against workspace folders to ensure cross-platform compatibility (1)
545
543
- Use `runTests` tool for programmatic test execution rather than terminal commands for better integration and result parsing (1)
546
-
- Mock wrapper functions (e.g., `workspaceApis.getConfiguration()`) instead of VS Code APIs directly to avoid stubbing issues (1)
544
+
- Mock wrapper functions (e.g., `workspaceApis.getConfiguration()`) instead of VS Code APIs directly to avoid stubbing issues (2)
547
545
- Start compilation with `npm run watch-tests` before test execution to ensure TypeScript files are built (1)
548
-
- Use `sinon.match()` patterns for resilient assertions that don't break on minor output changes (1)
546
+
- Use `sinon.match()` patterns for resilient assertions that don't break on minor output changes (2)
549
547
- Fix test issues iteratively - run tests, analyze failures, apply fixes, repeat until passing (1)
550
548
- When fixing mock environment creation, use `null` to truly omit properties rather than `undefined` (1)
551
549
- Always recompile TypeScript after making import/export changes before running tests, as stubs won't work if they're applied to old compiled JavaScript that doesn't have the updated imports (2)
552
550
- Create proxy abstraction functions for Node.js APIs like `cp.spawn` to enable clean testing - use function overloads to preserve Node.js's intelligent typing while making the functions mockable (1)
553
551
- When unit tests fail with VS Code API errors like `TypeError: X is not a constructor` or `Cannot read properties of undefined (reading 'Y')`, check if VS Code APIs are properly mocked in `/src/test/unittests.ts` - add missing Task-related APIs (`Task`, `TaskScope`, `ShellExecution`, `TaskRevealKind`, `TaskPanelKind`) and namespace mocks (`tasks`) following the existing pattern of `mockedVSCode.X = vscodeMocks.vscMockExtHostedTypes.X` (1)
552
+
- Create minimal mock objects with only required methods and use TypeScript type assertions (e.g., mockApi as PythonEnvironmentApi) to satisfy interface requirements instead of implementing all interface methods when only specific methods are needed for the test (1)
0 commit comments