Skip to content

Commit ee48b94

Browse files
committed
fix: make console stubs call through to original
Using stub().callThrough() allows us to: 1. Track calls for assertions 2. Still execute the original console methods 3. Avoid wrapping errors in VS Code test environment This should fix the 2 failing tests that check if console.log was called.
1 parent 108a510 commit ee48b94

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

vscode-extension/src/test/helpers/testUtils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ export function spyOnConsole(sandbox: sinon.SinonSandbox): {
183183
error: sinon.SinonSpy;
184184
warn: sinon.SinonSpy;
185185
} {
186-
// In VS Code test environment, use stubs instead of spies
187-
// to avoid wrapping issues with console methods
188-
const logSpy = sandbox.stub(console, 'log');
189-
const errorSpy = sandbox.stub(console, 'error');
190-
const warnSpy = sandbox.stub(console, 'warn');
186+
// In VS Code test environment, use stubs with callThrough
187+
// This allows us to track calls while still executing the original function
188+
const logSpy = sandbox.stub(console, 'log').callThrough();
189+
const errorSpy = sandbox.stub(console, 'error').callThrough();
190+
const warnSpy = sandbox.stub(console, 'warn').callThrough();
191191

192192
return {
193193
log: logSpy,

0 commit comments

Comments
 (0)