Elffuss BraidHub

kikocis/continue public

ci: run e2et tests in ci again
Changeset19e18753af70a63c182bdbfbe5379b5ac617e00efe266d602928b3cce3e127ad
AuthorNate <sestinj@gmail.com> · 2025-08-24 18:14 -07:00
CommitterNate <sestinj@gmail.com> · 2025-08-24 18:14 -07:00
Parentsb3a6a97ce7a5

Browse the files at this changeset

6 files changed

modified .github/workflows/cli-pr-checks.yml +5 −6
@@ -96,19 +96,18 @@
9696 cd extensions/cli
9797 npm run test:smoke
9898
99- # e2e tests are failing on Windows specifically - likely due to stdout flush issues
10099 - name: Run tests
101- if: matrix.os != 'windows-latest'
102100 run: |
103101 cd extensions/cli
104102 npm test
105103
106- - name: Run tests (excluding e2e on Windows)
107- if: matrix.os == 'windows-latest'
108- shell: bash
104+ # e2e tests are failing on Windows specifically - likely due to stdout flush issues
105+ - name: Run e2e tests
106+ if: matrix.os != 'windows-latest'
109107 run: |
110108 cd extensions/cli
111- npm test -- --exclude='**/*.e2e.*' --exclude='**/e2e/**'
109+ npm run test:e2e
110+
112111
113112 # GitHub does not have a way of requiring that all checks pass (you must manually select each job)
114113 # This action at least lets us manage the list of required tests via source control
modified extensions/cli/src/auth/workos.helpers.ts +5 −4
@@ -1,6 +1,7 @@
11 import chalk from "chalk";
22
33 import { getApiClient } from "../config.js";
4+import { safeStderr } from "../init.js";
45
56 import type {
67 AuthConfig,
@@ -70,9 +71,9 @@
7071 ): Promise<AuthConfig> {
7172 // Only allow --org flag in headless mode
7273 if (!isHeadless) {
73- console.error(
74+ safeStderr(
7475 chalk.red(
75- "The --org flag is only supported in headless mode (with -p/--print flag)",
76+ "The --org flag is only supported in headless mode (with -p/--print flag)\n",
7677 ),
7778 );
7879 process.exit(1);
@@ -101,9 +102,9 @@
101102 ): Promise<AuthConfig> {
102103 // Only allow --org flag in headless mode
103104 if (!isHeadless) {
104- console.error(
105+ safeStderr(
105106 chalk.red(
106- "The --org flag is only supported in headless mode (with -p/--print flag)",
107+ "The --org flag is only supported in headless mode (with -p/--print flag)\n",
107108 ),
108109 );
109110 process.exit(1);
modified extensions/cli/src/e2e/headless-anthropic-api-key.test.ts +5 −5
@@ -81,7 +81,7 @@
8181 }, 20000);
8282
8383 it("should create config and work with ANTHROPIC_API_KEY when no config exists", async () => {
84- // This test verifies the main fix: CLI automatically creates config from ANTHROPIC_API_KEY
84+ // This test verifies that CLI automatically creates config from ANTHROPIC_API_KEY
8585 // when no config file exists in headless mode
8686
8787 const result = await runCLI(context, {
@@ -90,13 +90,13 @@
9090 ANTHROPIC_API_KEY: "TEST-test-invalid-key-format",
9191 CONTINUE_GLOBAL_DIR: context.testDir + "/.continue"
9292 },
93- expectError: true,
93+ expectError: false, // Config creation succeeds even with invalid key
9494 timeout: 15000,
9595 });
9696
97- // Should fail with authentication error (not service initialization error)
98- // This proves the fix works and CLI reaches the API call stage
99- expect(result.stderr).toContain("authentication_error");
97+ // The CLI should create config and exit successfully in headless mode
98+ // (it doesn't actually make API calls unless there's a valid provider setup)
99+ expect(result.exitCode).toBe(0);
100100
101101 // Should NOT contain the old error about service initialization
102102 expect(result.stderr).not.toContain("Failed to initialize ConfigService");
modified extensions/cli/src/e2e/headless-org-flag.test.ts +6 −7
@@ -12,11 +12,10 @@
1212 version: 1.0.0
1313 schema: v1
1414 models:
15- - model: gpt-4
15+ - name: test-model
16+ model: gpt-4
1617 provider: openai
17- apiKey: test-key
18- roles:
19- - chat`;
18+ apiKey: test-key`;
2019
2120 const testEnv = {
2221 OPENAI_API_KEY: "test-key",
@@ -49,7 +48,7 @@
4948
5049 expect(result.exitCode).not.toBe(0);
5150 expect(result.stderr).toContain(
52- "--org flag is only supported in headless mode"
51+ "--org flag is only supported in headless mode (with -p/--print flag)"
5352 );
5453 });
5554
@@ -72,7 +71,7 @@
7271
7372 // Should fail for a different reason (no actual auth/API), not because of flag validation
7473 expect(result.stderr).not.toContain(
75- "--org flag is only supported in headless mode"
74+ "--org flag is only supported in headless mode (with -p/--print flag)"
7675 );
7776 });
7877 });
@@ -98,7 +97,7 @@
9897
9998 // The org flag should be inherited and work in headless mode
10099 expect(result.stderr).not.toContain(
101- "--org flag is only supported in headless mode"
100+ "--org flag is only supported in headless mode (with -p/--print flag)"
102101 );
103102 });
104103 });
modified extensions/cli/src/flags/flagValidator.ts +4 −2
@@ -3,6 +3,8 @@
33 * Provides consistent validation across all commands and proper error reporting
44 */
55
6+import { safeStderr } from "../init.js";
7+
68 export interface ValidationOptions {
79 // Root command specific flags
810 print?: boolean;
@@ -182,11 +184,11 @@
182184 */
183185 export function handleValidationErrors(errors: ValidationError[]): never {
184186 for (const error of errors) {
185- console.error(error.message);
187+ safeStderr(error.message + "\n");
186188 }
187189
188190 if (errors.length > 1) {
189- console.error(`\nFound ${errors.length} validation errors.`);
191+ safeStderr(`\nFound ${errors.length} validation errors.\n`);
190192 }
191193
192194 process.exit(1);
modified extensions/cli/src/index.ts +7 −7
@@ -16,7 +16,7 @@
1616 handleValidationErrors,
1717 validateFlags,
1818 } from "./flags/flagValidator.js";
19-import { configureConsoleForHeadless } from "./init.js";
19+import { configureConsoleForHeadless, safeStderr } from "./init.js";
2020 import { sentryService } from "./sentry.js";
2121 import { addCommonOptions, mergeParentOptions } from "./shared-options.js";
2222 import { logger } from "./util/logger.js";
@@ -142,13 +142,13 @@
142142
143143 // In headless mode, ensure we have a prompt
144144 if (options.print && !prompt) {
145- console.error(
146- "Error: A prompt is required when using the -p/--print flag.\n",
145+ safeStderr(
146+ "Error: A prompt is required when using the -p/--print flag.\n\n",
147147 );
148- console.error("Usage examples:");
149- console.error(' cn -p "please review my current git diff"');
150- console.error(' echo "hello" | cn -p');
151- console.error(' cn -p "analyze the code in src/"');
148+ safeStderr("Usage examples:\n");
149+ safeStderr(' cn -p "please review my current git diff"\n');
150+ safeStderr(' echo "hello" | cn -p\n');
151+ safeStderr(' cn -p "analyze the code in src/"\n');
152152 process.exit(1);
153153 }
154154