Skip to content

Commit 74a408b

Browse files
committed
update learning
1 parent 6989f40 commit 74a408b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,5 +569,5 @@ envConfig.inspect
569569
- 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)
570570
- When reviewing existing tests, focus on behavior rather than implementation details in test names and assertions - transform "should return X when Y" into "should [expected behavior] when [scenario context]" (1)
571571
- Simplify mock setup by only mocking methods actually used in tests and use `as unknown as Type` for TypeScript compatibility (1)
572-
- Avoid setting global default stub behaviors in setup() that require resetBehavior() calls; instead configure stub behaviors conditionally in each test to prevent conflicts and make tests self-contained (1)
573-
- Use conditional stub configuration with withArgs() instead of multiple resolves() calls to prevent Sinon behavior conflicts - if you must override a stub, call resetBehavior() first to clear previous configurations (1)
572+
- When testing async functions that use child processes, call the function first to get a promise, then use setTimeout to emit mock events, then await the promise - this ensures proper timing of mock setup versus function execution (1)
573+
- Cannot stub internal function calls within the same module after import - stub external dependencies instead (e.g., stub `childProcessApis.spawnProcess` rather than trying to stub `helpers.isUvInstalled` when testing `helpers.shouldUseUv`) because intra-module calls use direct references, not module exports (1)

0 commit comments

Comments
 (0)