ci: contain persistent transforms and trim model overhead (#28948)

This commit is contained in:
Neil
2026-10-14 20:22:13 -07:00
committed by GitHub
parent 3bfb1149da
commit bcaed523cd
3 changed files with 26 additions and 5 deletions
@@ -100,6 +100,23 @@ describe('timing-weighted shard selection', () => {
}
})
it.each([
{ name: 'absent', path: undefined, enabled: false },
{ name: 'empty', path: '', enabled: false },
{ name: 'explicit', path: join(tmpdir(), 'orca-unit-cache-experiment'), enabled: true }
])(
'uses persistent transforms only with an explicit cache path ($name)',
async ({ path, enabled }) => {
vi.stubEnv('ORCA_UNIT_MODULE_CACHE_PATH', path)
vi.resetModules()
const { default: config } = await import('../vitest.config')
for (const test of [config.test, ...config.test.projects.map((project) => project.test)]) {
expect(test.fsModuleCache).toBe(enabled)
expect(test.fsModuleCachePath).toBe(enabled ? path : undefined)
}
}
)
it('keeps nested/serial E2E files atomic and fails closed on discovery errors', () => {
const spec = (id, file) => ({ id, file, tests: [{ projectName: 'electron-headless' }] })
const report = {
+2 -1
View File
@@ -29,7 +29,8 @@ const transforms = {
const testOptions = {
environment: 'node',
clearMocks: false,
fsModuleCache: true,
// Persistent transforms can miss source additions; only explicit cache experiments opt in.
fsModuleCache: Boolean(process.env.ORCA_UNIT_MODULE_CACHE_PATH),
...(process.env.ORCA_UNIT_MODULE_CACHE_PATH
? { fsModuleCachePath: process.env.ORCA_UNIT_MODULE_CACHE_PATH }
: {}),
@@ -372,7 +372,7 @@ async function runSchedule(seed: number, stats: Stats): Promise<void> {
const arrived = checkPty(ptyWrites.join(''), ops, seed)
for (const op of ops) {
// A write the pane reported applied really reached the PTY, whole.
if (op.result === true) {
if (op.result === true && !arrived.has(op.id)) {
expect(arrived.has(op.id), `seed ${seed} op ${op.id} reported applied`).toBe(true)
}
}
@@ -389,15 +389,18 @@ function checkPty(pty: string, ops: readonly Op[], seed: number): Set<number> {
const arrived = new Set<number>()
let position = 0
for (const op of ops) {
const where = `seed ${seed} op ${op.id} (${op.status}) at ${position}: ${JSON.stringify(pty.slice(position, position + 40))}`
const where = (): string =>
`seed ${seed} op ${op.id} (${op.status}) at ${position}: ${JSON.stringify(pty.slice(position, position + 40))}`
if (pty.startsWith(op.text, position)) {
expect(op.status, where).not.toBe('forbidden')
if (op.status === 'forbidden') {
expect(op.status, where()).not.toBe('forbidden')
}
arrived.add(op.id)
position += op.text.length
continue
}
if (op.status === 'required') {
throw new Error(`missing or out of order: ${where}`)
throw new Error(`missing or out of order: ${where()}`)
}
if (op.status === 'optional') {
// A withdrawn chunked paste or a restart can cut it after a whole chunk.