mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix(cli): fix quiet mode tests by capturing console before host creation (#10827)
This commit is contained in:
parent
4093bff3ae
commit
ea62173792
2 changed files with 14 additions and 10 deletions
|
|
@ -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", () => {
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue