mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 18:07:45 +00:00
test: stop worker-teardown console race from failing unit shards (#39813)
Vitest rejects a console-log RPC still in flight when a worker tears down, failing a shard whose tests all passed. Ignore only that rejection (the lost line belongs to a finished file and passed-only shards drop it anyway), and stop the two specs seen in CI from spawning real git and wsl.exe in fire-and-forget background work. Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -142,6 +142,9 @@ export default defineConfig({
|
||||
}
|
||||
: {}),
|
||||
projects,
|
||||
// A finished file's background log can lose the race with worker teardown; only that log line is lost.
|
||||
onUnhandledError: (error) =>
|
||||
!(error.name === 'EnvironmentTeardownError' && error.message.includes('"onUserConsoleLog"')),
|
||||
...(process.platform === 'win32' ? { maxWorkers: 4 } : {})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import type * as LegacyWslRuntimeAuthDrain from './legacy-wsl-runtime-auth-drain'
|
||||
import type * as WslCodexSessionBridge from '../codex/history/bridges/wsl-codex-session-bridge'
|
||||
import { createSettings } from './runtime-home-settings-test-fixtures'
|
||||
import {
|
||||
createCodexAuthJson,
|
||||
@@ -16,6 +18,15 @@ import {
|
||||
vi.mock('../wsl/discovery/wsl-background-exec-gate', () => ({
|
||||
blockedWslDistroForExec: async () => null
|
||||
}))
|
||||
// Background WSL drain/bridge spawn wsl.exe and warn after the file ends; these specs cover only routing.
|
||||
vi.mock('./legacy-wsl-runtime-auth-drain', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof LegacyWslRuntimeAuthDrain>()),
|
||||
startLegacyWslRuntimeAuthDrain: async () => {}
|
||||
}))
|
||||
vi.mock('../codex/history/bridges/wsl-codex-session-bridge', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof WslCodexSessionBridge>()),
|
||||
startWslCodexSessionBridgeInBackground: async () => {}
|
||||
}))
|
||||
vi.mock('electron', () => ({
|
||||
app: {
|
||||
getPath: () => testState.userDataDir
|
||||
|
||||
@@ -294,6 +294,12 @@ vi.mock('../../git/worktrees/catalog/worktree-listing', async (importOriginal) =
|
||||
describeCreatedWorktree: (await getWorktreeOwnerMocks()).describeCreatedWorktree
|
||||
}))
|
||||
|
||||
// Fire-and-forget reclaim runs real Git on fixture paths and warns after the file ends.
|
||||
vi.mock(
|
||||
'../../workspaces/creation/preparation/worktree-create-preparation-project-removal',
|
||||
() => ({ releaseWorktreeCreatePreparationsForRepo: vi.fn() })
|
||||
)
|
||||
|
||||
const { getWorktreeOwnerMocks } = vi.hoisted(() => {
|
||||
function createWorktreeOwnerMocks() {
|
||||
return (() => ({
|
||||
|
||||
Reference in New Issue
Block a user