goose/ui/desktop/tests/integration/test_providers_code_exec.test.ts
Jack Amadeo c6755d3259
Some checks failed
Canary / Prepare Version (push) Waiting to run
Canary / build-cli (push) Blocked by required conditions
Canary / Upload Install Script (push) Blocked by required conditions
Canary / bundle-desktop (push) Blocked by required conditions
Canary / bundle-desktop-intel (push) Blocked by required conditions
Canary / bundle-desktop-linux (push) Blocked by required conditions
Canary / bundle-desktop-windows (push) Blocked by required conditions
Canary / Release (push) Blocked by required conditions
CI / Build Rust Project on Windows (push) Waiting to run
CI / changes (push) Waiting to run
CI / Check Rust Code Format (push) Blocked by required conditions
CI / Build and Test Rust Project (push) Blocked by required conditions
CI / Check MSRV (push) Blocked by required conditions
CI / Lint Rust Code (push) Blocked by required conditions
CI / Check Generated Schemas are Up-to-Date (push) Blocked by required conditions
CI / Test and Lint Electron Desktop App (push) Blocked by required conditions
Goose 2 CI / Lint & Format (push) Waiting to run
Goose 2 CI / Unit Tests (push) Waiting to run
Goose 2 CI / Desktop Build & E2E (push) Waiting to run
Goose 2 CI / Rust Lint (push) Waiting to run
Live Provider Tests / Smoke Tests (Code Execution) (push) Blocked by required conditions
Live Provider Tests / check-fork (push) Waiting to run
Live Provider Tests / changes (push) Blocked by required conditions
Live Provider Tests / Build Binary (push) Blocked by required conditions
Live Provider Tests / Smoke Tests (push) Blocked by required conditions
Live Provider Tests / Compaction Tests (push) Blocked by required conditions
Live Provider Tests / goose server HTTP integration tests (push) Blocked by required conditions
Publish Docker Image / docker (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Unused Dependencies / machete (push) Has been cancelled
Port provider tests to typescript (#8237)
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
2026-04-24 17:31:27 +00:00

50 lines
1.8 KiB
TypeScript

/**
* Provider smoke tests — code execution mode (JS batching).
*
* Each available (non-agentic) provider/model pair gets its own test that
* spawns `goose run` with the memory + code_execution builtins and validates
* that the code_execution tool was invoked.
*/
import { expect, beforeAll } from 'vitest';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { buildGoose, discoverTestCases, runGoose, providerTest } from './test_providers_lib';
const BUILTINS = 'memory,code_execution';
let gooseBin: string;
beforeAll(() => {
gooseBin = buildGoose();
});
const { testAll } = providerTest(discoverTestCases({ skipAgentic: true }));
testAll('invokes code_execution tool', async (tc) => {
const testdir = fs.mkdtempSync(path.join(os.tmpdir(), 'goose-codeexec-'));
try {
const output = await runGoose(
gooseBin,
testdir,
"Store a memory with category 'test' and data 'hello world', then retrieve all memories from category 'test'.",
BUILTINS,
{ GOOSE_PROVIDER: tc.provider, GOOSE_MODEL: tc.model }
);
// Matches: "execute_typescript | code_execution", "get_function_details | code_execution",
// "tool call | execute", "tool calls | execute" (old format)
// "▸ execute N tool call" (new format with tool_graph)
// "▸ execute_typescript" (plain tool name in output)
const codeExecPattern =
/(execute_typescript \| code_execution)|(get_function_details \| code_execution)|(tool calls? \| execute)|(▸.*execute.*tool call)|(▸ execute_typescript)/;
expect(
codeExecPattern.test(output),
`Expected code_execution tool to be called\n\nFull output:\n${output}`
).toBe(true);
} finally {
fs.rmSync(testdir, { recursive: true, force: true });
}
});