mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-25 06:26:53 +00:00
* test(e2e): stabilize MCP tool message flow * ci(e2e): cancel stale main E2E runs * test(e2e): accept paired MCP tool results * test(e2e): stabilize monitor tool check * test(e2e): stabilize run_shell_command file-listing assertion The model consistently picks list_directory over run_shell_command for file-listing prompts. Make the prompt explicit about which tool to use, matching the approach taken for the MCP tool flow test.
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { describe, it, expect, afterEach } from 'vitest';
|
|
import { TestRig, validateModelOutput } from '../test-helper.js';
|
|
|
|
describe('monitor-tool', () => {
|
|
let rig: TestRig;
|
|
|
|
afterEach(async () => {
|
|
if (rig) {
|
|
await rig.cleanup();
|
|
}
|
|
});
|
|
|
|
it('should have monitor tool registered', async () => {
|
|
rig = new TestRig();
|
|
await rig.setup('monitor-tool-registered');
|
|
|
|
const result = await rig.run(
|
|
'Do you have access to a tool called "monitor"? Reply with just "yes" or "no".',
|
|
);
|
|
|
|
validateModelOutput(result, null, 'monitor tool registered');
|
|
expect(result.toLowerCase()).toContain('yes');
|
|
});
|
|
|
|
it('should call monitor tool when asked to watch a command', async () => {
|
|
rig = new TestRig();
|
|
await rig.setup('monitor-tool-call');
|
|
|
|
const resultPromise = rig.run(
|
|
'Use the monitor tool to watch this command: for i in 1 2 3; do echo "EVENT_$i"; sleep 0.3; done. ' +
|
|
'Set description to "test events". After starting the monitor, just say "Monitor launched."',
|
|
);
|
|
|
|
const [result, foundMonitor] = await Promise.all([
|
|
resultPromise,
|
|
rig.waitForToolCall('monitor'),
|
|
]);
|
|
expect(foundMonitor).toBeTruthy();
|
|
validateModelOutput(result, null, 'monitor tool call');
|
|
}, 60000);
|
|
});
|