Files
deepseek-harness/vitest.web.config.ts
T
imccyu 0ee562045e ci: build once and fan web snapshots out across weighted shards (#8861)
* ci: build once and fan web snapshots out across weighted shards

* ci: stamp restored build output with the extraction time

Build-time mtimes shifted past the clock made HMR treat freshly loaded
lib/ modules as changed and reload a plugin context while it was still
loading (plugin-manager-mcp headless snapshot).

* ci(web): run the longest web snapshot files as round-robin test slices

* ci: address review on the build-once fan-out
2026-11-20 12:09:36 +08:00

43 lines
1.9 KiB
TypeScript

import tsconfigPaths from 'vite-tsconfig-paths'
import { configDefaults, defineConfig } from 'vitest/config'
import WebSnapshotSequencer from './scripts/web-snapshot-sequencer.ts'
import { webSnapshotProjects } from './scripts/web-snapshot-projects.ts'
import { standardDecoratorPlugin, vitestExecArgv } from './vitest.shared.ts'
// Web browser lane: real host entry points, built-client interaction snapshots,
// and replayed keyless e2e scenarios outside the unit/e2e includes. Linux PR CI
// pins DSH_SNAPSHOT=replay and compares committed goldens; record/refresh remain
// explicit local workflows. Real-model cases self-skip without DEEPSEEK_API_KEY.
try {
// Node >= 21.7 native; throws when the file does not exist.
process.loadEnvFile(new URL('.env', import.meta.url).pathname)
} catch (_missingEnvFile) {
// Without a root .env, tests read credentials from the process environment.
}
export default defineConfig({
// Same resolution note as vitest.config.ts: the tsconfig.base.json paths
// facade has no include (match-all), so apps/web/tests resolves bare
// workspace imports to source like every other lane.
plugins: [
tsconfigPaths({ projects: ['./tsconfig.base.json'] }),
standardDecoratorPlugin(),
],
test: {
execArgv: vitestExecArgv,
// Serial, main, and sliced long-file projects; see scripts/web-snapshot-projects.ts.
projects: webSnapshotProjects([
'apps/web/tests/**/*.e2e.ts',
'apps/web/tests/**/*.snapshot.ts',
'packages/experimental/inspector/tests/client-browser.e2e.ts',
], configDefaults.exclude),
// Local and record runs stay serial. CI runs workspace-mutating HMR and
// dynamic Cordis lifecycle coverage before parallelizing the remaining files.
testTimeout: 180_000,
hookTimeout: 120_000,
fileParallelism: false,
// `--shard` splits CI's two web snapshot machines by file weight, not file count.
sequence: { sequencer: WebSnapshotSequencer },
},
})