mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
- test:changed exits before starting Vitest when Git reports no changed files. - Unrecorded tests beyond 100 in scope use Vitest's static import graph instead of all running, so a fresh worktree's first changed run no longer runs the whole suite (patched RecordedModulesResolver; CI does not record, unchanged). - Bun's slow config load was the SQLite import scan statting every unit test; filtered runs now classify only the tests their filters can select, and the scan walks directories instead of fs.globSync. - Silence the native config loader notice on every run. - Zod's test bundle is content-addressed and reused, so a killed run leaks nothing; leaked per-run directories older than 6h are swept. - build:packages skips compiling when package inputs, compiler, and dist are unchanged; test scripts no longer nest pnpm invocations.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { hasNoChangedFiles } from './vitest-changed-precheck.mjs'
|
|
|
|
const clean = () => vi.fn(async () => ({ code: 0, stdout: '' }))
|
|
|
|
describe('hasNoChangedFiles', () => {
|
|
it('also checks commits since the ref', async () => {
|
|
const runProcess = clean()
|
|
await expect(
|
|
hasNoChangedFiles(['run', '--changed=origin/main'], '/repo', runProcess)
|
|
).resolves.toBe(true)
|
|
expect(runProcess.mock.calls.map(([spec]) => spec.args)).toContainEqual([
|
|
'diff',
|
|
'--name-only',
|
|
'-z',
|
|
'origin/main...HEAD'
|
|
])
|
|
})
|
|
|
|
it('starts Vitest when Git reports a file or cannot answer', async () => {
|
|
for (const result of [
|
|
{ code: 0, stdout: '?? src/a.ts\0' },
|
|
{ code: 128, stdout: '' }
|
|
]) {
|
|
const runProcess = vi.fn(async () => result)
|
|
await expect(hasNoChangedFiles(['run', '--changed'], '/repo', runProcess)).resolves.toBe(
|
|
false
|
|
)
|
|
}
|
|
})
|
|
|
|
it.each([
|
|
[['run', 'src/a']],
|
|
[['run', '--changed', 'src/a']],
|
|
[['run', '--changed', '--watch']],
|
|
[['related', '--changed']]
|
|
])('leaves %j to Vitest', async (args) => {
|
|
const runProcess = clean()
|
|
await expect(hasNoChangedFiles(args, '/repo', runProcess)).resolves.toBe(false)
|
|
expect(runProcess).not.toHaveBeenCalled()
|
|
})
|
|
})
|