diff options
| author | Tommaso Sciortino <[email protected]> | 2025-08-12 15:57:27 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-12 22:57:27 +0000 |
| commit | 9d023be1d16a6bf7427569f863e6cfd2c3442d8b (patch) | |
| tree | b983227f56fd9f26008b475061a345b61207c970 /integration-tests/run_shell_command.test.ts | |
| parent | 8d6eb8c322890b5cdf20d4a30dd17afb1541f5aa (diff) | |
Upgrade integration tests to use Vitest (#6021)
Diffstat (limited to 'integration-tests/run_shell_command.test.ts')
| -rw-r--r-- | integration-tests/run_shell_command.test.ts | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/integration-tests/run_shell_command.test.ts b/integration-tests/run_shell_command.test.ts index 2a5f9ed4..a1aa08ae 100644 --- a/integration-tests/run_shell_command.test.ts +++ b/integration-tests/run_shell_command.test.ts @@ -4,60 +4,67 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { test } from 'node:test'; -import { strict as assert } from 'assert'; +import { describe, it, expect } from 'vitest'; import { TestRig, printDebugInfo, validateModelOutput } from './test-helper.js'; -test('should be able to run a shell command', async () => { - const rig = new TestRig(); - await rig.setup('should be able to run a shell command'); +describe('run_shell_command', () => { + it('should be able to run a shell command', async () => { + const rig = new TestRig(); + await rig.setup('should be able to run a shell command'); - const prompt = `Please run the command "echo hello-world" and show me the output`; + const prompt = `Please run the command "echo hello-world" and show me the output`; - const result = await rig.run(prompt); + const result = await rig.run(prompt); - const foundToolCall = await rig.waitForToolCall('run_shell_command'); + const foundToolCall = await rig.waitForToolCall('run_shell_command'); - // Add debugging information - if (!foundToolCall || !result.includes('hello-world')) { - printDebugInfo(rig, result, { - 'Found tool call': foundToolCall, - 'Contains hello-world': result.includes('hello-world'), - }); - } + // Add debugging information + if (!foundToolCall || !result.includes('hello-world')) { + printDebugInfo(rig, result, { + 'Found tool call': foundToolCall, + 'Contains hello-world': result.includes('hello-world'), + }); + } - assert.ok(foundToolCall, 'Expected to find a run_shell_command tool call'); + expect( + foundToolCall, + 'Expected to find a run_shell_command tool call', + ).toBeTruthy(); - // Validate model output - will throw if no output, warn if missing expected content - // Model often reports exit code instead of showing output - validateModelOutput( - result, - ['hello-world', 'exit code 0'], - 'Shell command test', - ); -}); + // Validate model output - will throw if no output, warn if missing expected content + // Model often reports exit code instead of showing output + validateModelOutput( + result, + ['hello-world', 'exit code 0'], + 'Shell command test', + ); + }); -test('should be able to run a shell command via stdin', async () => { - const rig = new TestRig(); - await rig.setup('should be able to run a shell command via stdin'); + it('should be able to run a shell command via stdin', async () => { + const rig = new TestRig(); + await rig.setup('should be able to run a shell command via stdin'); - const prompt = `Please run the command "echo test-stdin" and show me what it outputs`; + const prompt = `Please run the command "echo test-stdin" and show me what it outputs`; - const result = await rig.run({ stdin: prompt }); + const result = await rig.run({ stdin: prompt }); - const foundToolCall = await rig.waitForToolCall('run_shell_command'); + const foundToolCall = await rig.waitForToolCall('run_shell_command'); - // Add debugging information - if (!foundToolCall || !result.includes('test-stdin')) { - printDebugInfo(rig, result, { - 'Test type': 'Stdin test', - 'Found tool call': foundToolCall, - 'Contains test-stdin': result.includes('test-stdin'), - }); - } + // Add debugging information + if (!foundToolCall || !result.includes('test-stdin')) { + printDebugInfo(rig, result, { + 'Test type': 'Stdin test', + 'Found tool call': foundToolCall, + 'Contains test-stdin': result.includes('test-stdin'), + }); + } - assert.ok(foundToolCall, 'Expected to find a run_shell_command tool call'); + expect( + foundToolCall, + 'Expected to find a run_shell_command tool call', + ).toBeTruthy(); - // Validate model output - will throw if no output, warn if missing expected content - validateModelOutput(result, 'test-stdin', 'Shell command stdin test'); + // Validate model output - will throw if no output, warn if missing expected content + validateModelOutput(result, 'test-stdin', 'Shell command stdin test'); + }); }); |
