|
27 | 27 | * shell-integration event/stream plumbing. |
28 | 28 | */ |
29 | 29 | import * as assert from "assert" |
| 30 | +import * as vscode from "vscode" |
30 | 31 |
|
31 | 32 | import { RooCodeEventName, type ClineMessage } from "@roo-code/types" |
32 | 33 |
|
33 | 34 | import { waitUntilCompleted } from "../utils" |
34 | 35 | import { setDefaultSuiteTimeout } from "../test-utils" |
35 | 36 |
|
| 37 | +const PROFILE_NAME = "Zoo E2E Zsh" |
| 38 | + |
36 | 39 | suite("Fast-exit shell integration race", function () { |
37 | 40 | if (process.platform !== "linux") { |
38 | 41 | return |
39 | 42 | } |
40 | 43 |
|
41 | 44 | setDefaultSuiteTimeout(this) |
42 | 45 |
|
| 46 | + let originalProfiles: Record<string, unknown> | undefined |
| 47 | + |
| 48 | + suiteSetup(async () => { |
| 49 | + // Save the current global linux profiles so we can restore them in teardown. |
| 50 | + originalProfiles = vscode.workspace |
| 51 | + .getConfiguration("terminal.integrated.profiles") |
| 52 | + .inspect<Record<string, unknown>>("linux")?.globalValue |
| 53 | + |
| 54 | + // Write a Zsh test profile to VS Code global settings to bypass the VS Code Bash parser bug |
| 55 | + await vscode.workspace.getConfiguration("terminal.integrated.profiles").update( |
| 56 | + "linux", |
| 57 | + { |
| 58 | + ...originalProfiles, |
| 59 | + [PROFILE_NAME]: { path: "/bin/zsh", args: ["--no-globalrcs", "--norc"] }, |
| 60 | + }, |
| 61 | + vscode.ConfigurationTarget.Global, |
| 62 | + ) |
| 63 | + |
| 64 | + // Activate the profile override |
| 65 | + globalThis.api.setTerminalProfile(PROFILE_NAME) |
| 66 | + }) |
| 67 | + |
| 68 | + suiteTeardown(async () => { |
| 69 | + // Restore profiles |
| 70 | + globalThis.api.setTerminalProfile(undefined) |
| 71 | + |
| 72 | + await vscode.workspace |
| 73 | + .getConfiguration("terminal.integrated.profiles") |
| 74 | + .update("linux", originalProfiles, vscode.ConfigurationTarget.Global) |
| 75 | + }) |
| 76 | + |
43 | 77 | setup(async () => { |
44 | 78 | try { |
45 | 79 | await globalThis.api.cancelCurrentTask() |
|
0 commit comments