mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-08 22:21:23 +00:00
fix: complete CI test fixes and async disposal
- Make CodeIndexManager.disposeAll() async and await it in extension deactivation - Update unit tests to reflect new worker-based architecture - Add indexing-worker.ts to knip ignore list to fix unused file warning - Update test setup/teardown to use async disposal
This commit is contained in:
parent
65b3528f72
commit
a928e2b9d1
4 changed files with 12 additions and 13 deletions
|
|
@ -6,6 +6,7 @@
|
|||
"src/extension/api.ts",
|
||||
"src/activate/**",
|
||||
"src/workers/countTokens.ts",
|
||||
"src/workers/indexing-worker.ts",
|
||||
"src/extension.ts",
|
||||
"scripts/**"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
export async function deactivate() {
|
||||
outputChannel.appendLine(`${Package.name} extension deactivated`)
|
||||
await McpServerManager.cleanup(extensionContext)
|
||||
CodeIndexManager.disposeAll()
|
||||
await CodeIndexManager.disposeAll()
|
||||
TelemetryService.instance.shutdown()
|
||||
TerminalRegistry.cleanup()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
|
|||
let mockContext: any
|
||||
let manager: CodeIndexManager
|
||||
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
// Clear all instances before each test
|
||||
CodeIndexManager.disposeAll()
|
||||
await CodeIndexManager.disposeAll()
|
||||
|
||||
mockContext = {
|
||||
subscriptions: [],
|
||||
|
|
@ -44,8 +44,8 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
|
|||
manager = CodeIndexManager.getInstance(mockContext)!
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
CodeIndexManager.disposeAll()
|
||||
afterEach(async () => {
|
||||
await CodeIndexManager.disposeAll()
|
||||
})
|
||||
|
||||
describe("handleSettingsChange", () => {
|
||||
|
|
@ -93,15 +93,14 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
|
|||
;(manager as any)._configManager = mockConfigManager
|
||||
|
||||
// Simulate an initialized manager by setting the required properties
|
||||
;(manager as any)._orchestrator = { stopWatcher: vitest.fn() }
|
||||
;(manager as any)._searchService = {}
|
||||
;(manager as any)._cacheManager = {}
|
||||
;(manager as any)._worker = { terminate: vitest.fn() }
|
||||
;(manager as any)._workerReady = true
|
||||
|
||||
// Verify manager is considered initialized
|
||||
expect(manager.isInitialized).toBe(true)
|
||||
|
||||
// Mock the methods that would be called during restart
|
||||
const recreateServicesSpy = vitest.spyOn(manager as any, "_recreateServices").mockImplementation(() => {})
|
||||
const recreateWorkerSpy = vitest.spyOn(manager as any, "_recreateWorker").mockResolvedValue(undefined)
|
||||
const startIndexingSpy = vitest.spyOn(manager, "startIndexing").mockResolvedValue()
|
||||
|
||||
// Mock the feature state
|
||||
|
|
@ -112,8 +111,7 @@ describe("CodeIndexManager - handleSettingsChange regression", () => {
|
|||
|
||||
// Verify that the restart sequence was called
|
||||
expect(mockConfigManager.loadConfiguration).toHaveBeenCalled()
|
||||
// stopWatcher is called inside _recreateServices, which we mocked
|
||||
expect(recreateServicesSpy).toHaveBeenCalled()
|
||||
expect(recreateWorkerSpy).toHaveBeenCalled()
|
||||
expect(startIndexingSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ export class CodeIndexManager {
|
|||
return CodeIndexManager.instances.get(workspacePath)!
|
||||
}
|
||||
|
||||
public static disposeAll(): void {
|
||||
public static async disposeAll(): Promise<void> {
|
||||
for (const instance of CodeIndexManager.instances.values()) {
|
||||
instance.dispose()
|
||||
await instance.dispose()
|
||||
}
|
||||
CodeIndexManager.instances.clear()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue