Skip to content

Commit 0d8156a

Browse files
committed
test(terminal): cover shell integration fallback
1 parent c1ac6d3 commit 0d8156a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/test/features/terminal/runInTerminal.unit.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,21 @@ suite('runInTerminal', () => {
5656
endListener!({ terminal, execution } as unknown as TerminalShellExecutionEndEvent);
5757
await runPromise;
5858
});
59+
60+
test('uses sendText when shell integration is unavailable after waiting', async () => {
61+
sinon.stub(shellDetector, 'identifyTerminalShell').returns('fish');
62+
const waitForShellIntegrationStub = sinon.stub(terminalUtils, 'waitForShellIntegration').resolves(false);
63+
const sendText = sinon.stub();
64+
const terminal = {
65+
name: 'Python',
66+
shellIntegration: undefined,
67+
sendText,
68+
} as unknown as Terminal;
69+
70+
const environment = createMockPythonEnvironment({ envPath: '/env/bin/python' });
71+
await runInTerminal(environment, terminal, { cwd: '/workspace', args: ['main.py'] });
72+
73+
sinon.assert.calledOnceWithExactly(waitForShellIntegrationStub, terminal);
74+
sinon.assert.calledOnceWithExactly(sendText, 'python main.py\n');
75+
});
5976
});

0 commit comments

Comments
 (0)