@@ -8,37 +8,12 @@ namespace GitHub.Copilot.SDK.Test;
88
99// These tests bypass E2ETestBase because they are about how the CLI subprocess is started
1010// Other test classes should instead inherit from E2ETestBase
11- public class ClientTests : IAsyncLifetime
11+ public class ClientTests
1212{
13- private string _cliPath = null ! ;
14-
15- public Task InitializeAsync ( )
16- {
17- _cliPath = GetCliPath ( ) ;
18- return Task . CompletedTask ;
19- }
20-
21- public Task DisposeAsync ( ) => Task . CompletedTask ;
22-
23- private static string GetCliPath ( )
24- {
25- var envPath = Environment . GetEnvironmentVariable ( "COPILOT_CLI_PATH" ) ;
26- if ( ! string . IsNullOrEmpty ( envPath ) ) return envPath ;
27-
28- var dir = new DirectoryInfo ( AppContext . BaseDirectory ) ;
29- while ( dir != null )
30- {
31- var path = Path . Combine ( dir . FullName , "nodejs/node_modules/@github/copilot/index.js" ) ;
32- if ( File . Exists ( path ) ) return path ;
33- dir = dir . Parent ;
34- }
35- throw new InvalidOperationException ( "CLI not found. Run 'npm install' in the nodejs directory first." ) ;
36- }
37-
3813 [ Fact ]
3914 public async Task Should_Start_And_Connect_To_Server_Using_Stdio ( )
4015 {
41- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath , UseStdio = true } ) ;
16+ using var client = new CopilotClient ( new CopilotClientOptions { UseStdio = true } ) ;
4217
4318 try
4419 {
@@ -61,7 +36,7 @@ public async Task Should_Start_And_Connect_To_Server_Using_Stdio()
6136 [ Fact ]
6237 public async Task Should_Start_And_Connect_To_Server_Using_Tcp ( )
6338 {
64- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath , UseStdio = false } ) ;
39+ using var client = new CopilotClient ( new CopilotClientOptions { UseStdio = false } ) ;
6540
6641 try
6742 {
@@ -82,7 +57,7 @@ public async Task Should_Start_And_Connect_To_Server_Using_Tcp()
8257 [ Fact ]
8358 public async Task Should_Force_Stop_Without_Cleanup ( )
8459 {
85- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath } ) ;
60+ using var client = new CopilotClient ( new CopilotClientOptions ( ) ) ;
8661
8762 await client . CreateSessionAsync ( ) ;
8863 await client . ForceStopAsync ( ) ;
@@ -93,7 +68,7 @@ public async Task Should_Force_Stop_Without_Cleanup()
9368 [ Fact ]
9469 public async Task Should_Get_Status_With_Version_And_Protocol_Info ( )
9570 {
96- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath , UseStdio = true } ) ;
71+ using var client = new CopilotClient ( new CopilotClientOptions { UseStdio = true } ) ;
9772
9873 try
9974 {
@@ -115,7 +90,7 @@ public async Task Should_Get_Status_With_Version_And_Protocol_Info()
11590 [ Fact ]
11691 public async Task Should_Get_Auth_Status ( )
11792 {
118- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath , UseStdio = true } ) ;
93+ using var client = new CopilotClient ( new CopilotClientOptions { UseStdio = true } ) ;
11994
12095 try
12196 {
@@ -140,7 +115,7 @@ public async Task Should_Get_Auth_Status()
140115 [ Fact ]
141116 public async Task Should_List_Models_When_Authenticated ( )
142117 {
143- using var client = new CopilotClient ( new CopilotClientOptions { CliPath = _cliPath , UseStdio = true } ) ;
118+ using var client = new CopilotClient ( new CopilotClientOptions { UseStdio = true } ) ;
144119
145120 try
146121 {
@@ -178,7 +153,6 @@ public void Should_Accept_GithubToken_Option()
178153 {
179154 var options = new CopilotClientOptions
180155 {
181- CliPath = _cliPath ,
182156 GithubToken = "gho_test_token"
183157 } ;
184158
@@ -188,7 +162,7 @@ public void Should_Accept_GithubToken_Option()
188162 [ Fact ]
189163 public void Should_Default_UseLoggedInUser_To_Null ( )
190164 {
191- var options = new CopilotClientOptions { CliPath = _cliPath } ;
165+ var options = new CopilotClientOptions ( ) ;
192166
193167 Assert . Null ( options . UseLoggedInUser ) ;
194168 }
@@ -198,7 +172,6 @@ public void Should_Allow_Explicit_UseLoggedInUser_False()
198172 {
199173 var options = new CopilotClientOptions
200174 {
201- CliPath = _cliPath ,
202175 UseLoggedInUser = false
203176 } ;
204177
@@ -210,7 +183,6 @@ public void Should_Allow_Explicit_UseLoggedInUser_True_With_GithubToken()
210183 {
211184 var options = new CopilotClientOptions
212185 {
213- CliPath = _cliPath ,
214186 GithubToken = "gho_test_token" ,
215187 UseLoggedInUser = true
216188 } ;
0 commit comments