Skip to content

Commit dfd622e

Browse files
authored
fix(ci): fix windows e2e tests (google-gemini#7749)
1 parent 968e938 commit dfd622e

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

.github/workflows/e2e.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
os:
3232
- 'ubuntu-latest'
3333
- 'macos-latest'
34+
- 'gemini-cli-windows-16-core'
3435
sandbox:
3536
- 'sandbox:none'
3637
- 'sandbox:docker'
@@ -40,6 +41,8 @@ jobs:
4041
# Docker tests are not supported on macOS or Windows
4142
- os: 'macos-latest'
4243
sandbox: 'sandbox:docker'
44+
- os: 'gemini-cli-windows-16-core'
45+
sandbox: 'sandbox:docker'
4346

4447
steps:
4548
- name: 'Checkout (fork)'
@@ -57,7 +60,6 @@ jobs:
5760
uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions-node@v4
5861
with:
5962
node-version: '${{ matrix.node-version }}'
60-
cache: 'npm'
6163

6264
- name: 'Install dependencies'
6365
run: |-
@@ -78,5 +80,6 @@ jobs:
7880
KEEP_OUTPUT: 'true'
7981
SANDBOX: '${{ matrix.sandbox }}'
8082
VERBOSE: 'true'
83+
shell: 'bash'
8184
run: |-
8285
npm run "test:integration:${SANDBOX}"

integration-tests/shell-service.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ describe('ShellExecutionService programmatic integration tests', () => {
9696
);
9797

9898
it('should abort a running process', async () => {
99-
// A command that runs for a bit. 'sleep' on unix, 'timeout' on windows.
100-
const command = process.platform === 'win32' ? 'timeout /t 20' : 'sleep 20';
99+
// A command that runs for a bit.
100+
const command = 'node -e "setTimeout(() => {}, 20000)"';
101101
const onOutputEvent = vi.fn();
102102
const abortController = new AbortController();
103103

integration-tests/test-helper.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
import { execSync, spawn } from 'node:child_process';
8-
import { parse } from 'shell-quote';
98
import { mkdirSync, writeFileSync, readFileSync } from 'node:fs';
109
import { join, dirname } from 'node:path';
1110
import { fileURLToPath } from 'node:url';
@@ -182,7 +181,7 @@ export class TestRig {
182181
| { prompt?: string; stdin?: string; stdinDoesNotEnd?: boolean },
183182
...args: string[]
184183
): Promise<string> {
185-
let command = `node ${this.bundlePath} --yolo`;
184+
const commandArgs = [this.bundlePath, '--yolo'];
186185
const execOptions: {
187186
cwd: string;
188187
encoding: 'utf-8';
@@ -193,25 +192,22 @@ export class TestRig {
193192
};
194193

195194
if (typeof promptOrOptions === 'string') {
196-
command += ` --prompt ${JSON.stringify(promptOrOptions)}`;
195+
commandArgs.push('--prompt', promptOrOptions);
197196
} else if (
198197
typeof promptOrOptions === 'object' &&
199198
promptOrOptions !== null
200199
) {
201200
if (promptOrOptions.prompt) {
202-
command += ` --prompt ${JSON.stringify(promptOrOptions.prompt)}`;
201+
commandArgs.push('--prompt', promptOrOptions.prompt);
203202
}
204203
if (promptOrOptions.stdin) {
205204
execOptions.input = promptOrOptions.stdin;
206205
}
207206
}
208207

209-
command += ` ${args.join(' ')}`;
208+
commandArgs.push(...args);
210209

211-
const commandArgs = parse(command);
212-
const node = commandArgs.shift() as string;
213-
214-
const child = spawn(node, commandArgs as string[], {
210+
const child = spawn('node', commandArgs, {
215211
cwd: this.testDir!,
216212
stdio: 'pipe',
217213
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"test:scripts": "vitest run --config ./scripts/tests/vitest.config.ts",
3737
"test:e2e": "cross-env VERBOSE=true KEEP_OUTPUT=true npm run test:integration:sandbox:none",
3838
"test:integration:all": "npm run test:integration:sandbox:none && npm run test:integration:sandbox:docker && npm run test:integration:sandbox:podman",
39-
"test:integration:sandbox:none": "GEMINI_SANDBOX=false vitest run --root ./integration-tests",
40-
"test:integration:sandbox:docker": "GEMINI_SANDBOX=docker npm run build:sandbox && GEMINI_SANDBOX=docker vitest run --root ./integration-tests",
41-
"test:integration:sandbox:podman": "GEMINI_SANDBOX=podman vitest run --root ./integration-tests",
39+
"test:integration:sandbox:none": "cross-env GEMINI_SANDBOX=false vitest run --root ./integration-tests",
40+
"test:integration:sandbox:docker": "cross-env GEMINI_SANDBOX=docker npm run build:sandbox && cross-env GEMINI_SANDBOX=docker vitest run --root ./integration-tests",
41+
"test:integration:sandbox:podman": "cross-env GEMINI_SANDBOX=podman vitest run --root ./integration-tests",
4242
"lint": "eslint . --ext .ts,.tsx && eslint integration-tests",
4343
"lint:fix": "eslint . --fix && eslint integration-tests --fix",
4444
"lint:ci": "eslint . --ext .ts,.tsx --max-warnings 0 && eslint integration-tests --max-warnings 0",

0 commit comments

Comments
 (0)