Skip to content

Commit 9fee9b2

Browse files
committed
Remove disabled annotation from AskUserTest and update E2ETestContext to locate CLI in test/harness directory
1 parent f7d83ef commit 9fee9b2

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/test/java/com/github/copilot/sdk/AskUserTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,14 @@
2020
import com.github.copilot.sdk.json.UserInputRequest;
2121
import com.github.copilot.sdk.json.UserInputResponse;
2222

23-
import org.junit.jupiter.api.Disabled;
24-
2523
/**
2624
* Tests for user input handler (ask_user) functionality.
2725
*
2826
* <p>
2927
* These tests use the shared CapiProxy infrastructure for deterministic API
3028
* response replay. Snapshots are stored in test/snapshots/ask-user/.
3129
* </p>
32-
* <p>
33-
* <b>Note:</b> These tests are currently disabled because they require CLI
34-
* version 0.0.400+ which supports the ask_user tool. The test harness uses a
35-
* separate XDG_CONFIG_HOME which causes the CLI to download an older runtime
36-
* version (0.0.394) that doesn't support ask_user.
37-
* </p>
3830
*/
39-
@Disabled("Requires CLI version 0.0.400+ with ask_user tool support. See class javadoc for details.")
4031
public class AskUserTest {
4132

4233
private static E2ETestContext ctx;

src/test/java/com/github/copilot/sdk/E2ETestContext.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,35 @@ private static String getCliPath(Path repoRoot) throws IOException {
221221
return envPath;
222222
}
223223

224+
// Try test harness platform-specific binary (preferred as it works directly)
225+
String os = System.getProperty("os.name").toLowerCase();
226+
String arch = System.getProperty("os.arch").toLowerCase();
227+
String platform = os.contains("mac") ? "darwin" : os.contains("win") ? "win32" : "linux";
228+
String cpuArch = arch.contains("aarch64") || arch.contains("arm64") ? "arm64" : "x64";
229+
Path platformBinary = repoRoot
230+
.resolve("test/harness/node_modules/@github/copilot-" + platform + "-" + cpuArch + "/copilot");
231+
if (os.contains("win")) {
232+
platformBinary = repoRoot
233+
.resolve("test/harness/node_modules/@github/copilot-" + platform + "-" + cpuArch + "/copilot.exe");
234+
}
235+
if (Files.exists(platformBinary)) {
236+
return platformBinary.toString();
237+
}
238+
239+
// Try test harness npm-loader.js
240+
Path harnessCliPath = repoRoot.resolve("test/harness/node_modules/@github/copilot/npm-loader.js");
241+
if (Files.exists(harnessCliPath)) {
242+
return harnessCliPath.toString();
243+
}
244+
224245
// Try nodejs installation
225246
Path cliPath = repoRoot.resolve("nodejs/node_modules/@github/copilot/index.js");
226247
if (Files.exists(cliPath)) {
227248
return cliPath.toString();
228249
}
229250

230251
throw new IOException("CLI not found. Either install 'copilot' globally, set COPILOT_CLI_PATH, "
231-
+ "or run 'npm install' in the nodejs directory.");
252+
+ "or run 'npm install' in the nodejs directory or test/harness directory.");
232253
}
233254

234255
private static String findCopilotInPath() {

0 commit comments

Comments
 (0)