Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions apps/cli/src/agent/__tests__/extension-host.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,17 @@ describe("ExtensionHost", () => {
ephemeral: false,
debug: false,
exitOnComplete: false,
integrationTest: true, // Set explicitly for testing
}

const host = new ExtensionHost(options)

// Options are stored but integrationTest is set to true
// Options are stored as-is
const storedOptions = getPrivate<ExtensionHostOptions>(host, "options")
expect(storedOptions.mode).toBe(options.mode)
expect(storedOptions.workspacePath).toBe(options.workspacePath)
expect(storedOptions.extensionPath).toBe(options.extensionPath)
expect(storedOptions.integrationTest).toBe(true) // Always set to true in constructor
expect(storedOptions.integrationTest).toBe(true)
})

it("should be an EventEmitter instance", () => {
Expand Down Expand Up @@ -298,16 +299,19 @@ describe("ExtensionHost", () => {
})

it("should suppress console when integrationTest is false", () => {
const host = createTestHost()
// Capture the real console.log before any host is created
const originalLog = console.log

// Override integrationTest to false
// Create host with integrationTest: true to prevent constructor from suppressing
const host = createTestHost({ integrationTest: true })

// Override integrationTest to false to test suppression
const options = getPrivate<ExtensionHostOptions>(host, "options")
options.integrationTest = false

callPrivate(host, "setupQuietMode")

// Console should be modified
// Console should be modified (suppressed)
expect(console.log).not.toBe(originalLog)

// Restore for other tests
Expand All @@ -332,9 +336,12 @@ describe("ExtensionHost", () => {

describe("restoreConsole", () => {
it("should restore original console methods when suppressed", () => {
const host = createTestHost()
// Capture the real console.log before any host is created
const originalLog = console.log

// Create host with integrationTest: true to prevent constructor from suppressing
const host = createTestHost({ integrationTest: true })

// Override integrationTest to false to actually suppress
const options = getPrivate<ExtensionHostOptions>(host, "options")
options.integrationTest = false
Expand Down
5 changes: 1 addition & 4 deletions apps/cli/src/agent/extension-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,7 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
constructor(options: ExtensionHostOptions) {
super()

this.options = {
...options,
integrationTest: true, // Always set to true in CLI mode to allow tests to control console suppression
}
this.options = options

// Set up quiet mode early, before any extension code runs.
// This suppresses console output from the extension during load.
Expand Down
Loading