test: import mocked-module graphs one at a time after vi.mock (#34103)

Same Vitest registration race as the daemon-init fix: concurrent first imports
can load dependencies before pending vi.mock/vi.doMock calls are registered.
This commit is contained in:
Neil
2026-10-26 15:26:32 -07:00
committed by GitHub
parent c2c545f245
commit b58513a049
2 changed files with 7 additions and 9 deletions
@@ -50,10 +50,9 @@ export async function loadJiraClientModule(
})
// Split modules must share one graph, request queue and credential cache per reset.
const [client, queue, api] = await Promise.all([
import('../client'),
import('../request-queue'),
import('../authenticated-request')
])
// Why sequential: concurrent first imports can bypass Vitest's still-pending vi.doMock('os').
const client = await import('../client')
const queue = await import('../request-queue')
const api = await import('../authenticated-request')
return { ...client, ...queue, ...api }
}
@@ -159,10 +159,9 @@ describe('insertPaneNextTo reparent frame', () => {
it('passes pane drag active callbacks into dividers created during reorder', async () => {
setupDocument()
const [{ insertPaneNextTo }, { createDivider }] = await Promise.all([
import('./pane-tree-ops'),
import('./pane-divider')
])
// Why sequential: concurrent first imports can bypass Vitest's still-pending vi.mock registrations.
const { insertPaneNextTo } = await import('./pane-tree-ops')
const { createDivider } = await import('./pane-divider')
const parent = createMockElement('pane-split')
const source = createPane(1)
const target = createPane(2)