@@ -4,7 +4,7 @@ import fs from "node:fs";
44import os from "node:os" ;
55import path from "node:path" ;
66import { Readable , Writable } from "node:stream" ;
7- import { describe , vi } from "vitest" ;
7+ import { describe , expect , vi } from "vitest" ;
88import { removeDirectoryWithRetry } from "../../acp-test-utils" ;
99
1010export const RUN_E2E_TESTS = process . env [ "RUN_E2E_TESTS" ] === "true" ;
@@ -25,6 +25,17 @@ export function describeE2E(name: string, factory: () => void, timeoutMs = DEFAU
2525 describe . skipIf ( ! RUN_E2E_TESTS ) ( name , { timeout : timeoutMs } , factory ) ;
2626}
2727
28+ export async function expectStatus (
29+ session : SpawnedSessionFixture ,
30+ fields : Record < string , unknown > ,
31+ ) : Promise < void > {
32+ await session . expectPromptText ( "/status" , ( text ) => {
33+ for ( const [ field , value ] of Object . entries ( fields ) ) {
34+ expect ( text ) . toContain ( `**${ field } :** ${ String ( value ) } ` ) ;
35+ }
36+ } ) ;
37+ }
38+
2839interface TestSkill {
2940 readonly name : string ;
3041 readonly description : string ;
@@ -68,7 +79,8 @@ export async function createFixtureWithSkill(skill: TestSkill): Promise<SpawnedA
6879}
6980
7081export async function createAuthenticatedFixture (
71- runtimePaths = createTemporaryRuntimePaths ( )
82+ runtimePaths = createTemporaryRuntimePaths ( ) ,
83+ extraEnv ?: NodeJS . ProcessEnv ,
7284) : Promise < SpawnedAgentFixture > {
7385 const apiKey = requireLiveApiKey ( ) ;
7486 return await createSpawnedFixture ( async ( connection , authMethods ) => {
@@ -89,7 +101,7 @@ export async function createAuthenticatedFixture(
89101 if ( authenticationStatus [ "type" ] !== "api-key" ) {
90102 throw new Error ( `Unexpected authentication status: ${ JSON . stringify ( authenticationStatus ) } ` ) ;
91103 }
92- } , runtimePaths ) ;
104+ } , runtimePaths , extraEnv ) ;
93105}
94106
95107export interface GatewayFixtureOptions {
@@ -128,13 +140,15 @@ type Authenticator = (connection: acp.ClientSideConnection, authMethods: acp.Aut
128140async function createSpawnedFixture (
129141 authenticate : Authenticator ,
130142 runtimePaths : RuntimePaths ,
143+ extraEnv ?: NodeJS . ProcessEnv ,
131144) : Promise < SpawnedAgentFixture > {
132145 const agentProcess = spawn ( "npm" , [ "run" , "--silent" , "start" ] , {
133146 cwd : process . cwd ( ) ,
134147 env : {
135148 ...process . env ,
136149 CODEX_HOME : runtimePaths . codexHome ,
137150 APP_SERVER_LOGS : runtimePaths . appServerLogsDir ,
151+ ...extraEnv ,
138152 } ,
139153 stdio : [ "pipe" , "pipe" , "pipe" ] ,
140154 } ) ;
0 commit comments