Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/agent/runner/harness/pi/__tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,14 @@ describe('pi check_env_keys — failures arrive as rejections', () => {
// instead of arriving as a failed tool call. Dropping `async` here — the
// scan removed the last `await` — is what made that reachable.
const { checkEnvKeys } = makeTools({});
const run = () =>
call(checkEnvKeys, { keys: ['ANY'], filePath: '../../etc/passwd' });

expect(run).not.toThrow();
return expect(run()).rejects.toThrow('Path traversal rejected');
let result: Promise<unknown> | undefined;
expect(() => {
result = call(checkEnvKeys, {
keys: ['ANY'],
filePath: '../../etc/passwd',
});
}).not.toThrow();
return expect(result).rejects.toThrow('Path traversal rejected');
});

it('answers normally for a path inside the working directory', async () => {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"bin.ts",
"tsdown.config.ts",
"vitest.config.ts",
"vitest.setup.ts",
"spec/**/*",
"src/**/*",
"test/**/*",
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default defineConfig({
test: {
globals: true,
environment: 'node',
setupFiles: [r('vitest.setup.ts')],
projects: [
project('agent', AGENT_TESTS),
project('programs', PROGRAM_TESTS),
Expand Down
4 changes: 4 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { vi } from 'vitest';

// Tests must never send events or exceptions to production PostHog.
vi.mock('posthog-node');
Loading