mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
69 lines
2.5 KiB
TypeScript
69 lines
2.5 KiB
TypeScript
/** Coverage shard definitions for the GitHub Actions source-test lanes. */
|
|
|
|
/** A coverage lane that owns complete package roots and optional cross-package tests. */
|
|
export interface CoverageShard {
|
|
/** Stable lane identifier passed through `DSH_COVERAGE_SHARD`. */
|
|
name: string
|
|
/** Group or package paths below `packages/` whose tests and source coverage belong to the lane. */
|
|
packageRoots: readonly string[]
|
|
/** Additional test roots needed for cross-package behavior or repository scripts. */
|
|
extraTestRoots?: readonly string[]
|
|
}
|
|
|
|
/** Exhaustive, non-overlapping ownership of workspace packages in coverage CI. */
|
|
export const coverageShards = [
|
|
{
|
|
name: 'spine',
|
|
packageRoots: ['core', 'llm', 'compact', 'context'],
|
|
extraTestRoots: ['packages/examples/cli-demo/tests'],
|
|
},
|
|
{ name: 'sdk', packageRoots: ['sdk'] },
|
|
{
|
|
name: 'interfaces',
|
|
packageRoots: ['ui', 'examples', 'goal'],
|
|
extraTestRoots: ['examples'],
|
|
},
|
|
{ name: 'execution', packageRoots: ['fs', 'bash', 'sandbox', 'code-runtime'] },
|
|
{ name: 'orchestration', packageRoots: ['workflow', 'subagent', 'tasks'] },
|
|
{
|
|
name: 'infrastructure',
|
|
packageRoots: ['cordis', 'support', 'lsp', 'mcp'],
|
|
extraTestRoots: ['scripts'],
|
|
},
|
|
{
|
|
name: 'session-state',
|
|
packageRoots: ['session-persistence', 'session-query'],
|
|
},
|
|
{ name: 'hooks-claude', packageRoots: ['hooks/hook-protocol', 'hooks/hooks-claude'] },
|
|
{ name: 'hooks-codex', packageRoots: ['hooks/hooks-codex'] },
|
|
{
|
|
name: 'capabilities',
|
|
packageRoots: ['web', 'skill', 'spill', 'util', 'guard', 'todo', 'timeout'],
|
|
},
|
|
] as const satisfies readonly CoverageShard[]
|
|
|
|
/**
|
|
* Build Vitest filters and coverage include globs for one source-test lane.
|
|
*
|
|
* @param name Stable shard name from {@link coverageShards}.
|
|
* @returns Positional test roots followed by per-group coverage include flags.
|
|
*/
|
|
export function coverageArgs(name: string): string[] {
|
|
const shard = coverageShards.find(candidate => candidate.name === name)
|
|
if (shard === undefined) {
|
|
throw new Error(`run-gates: unknown DSH_COVERAGE_SHARD ${JSON.stringify(name)}.`)
|
|
}
|
|
|
|
const testRoots = new Set([
|
|
...shard.packageRoots.map(packageRoot => `packages/${packageRoot}`),
|
|
...('extraTestRoots' in shard ? shard.extraTestRoots : []),
|
|
'scripts/test-invariants.spec.ts',
|
|
])
|
|
return [
|
|
...testRoots,
|
|
...shard.packageRoots.map(packageRoot => packageRoot.includes('/')
|
|
? `--coverage.include=packages/${packageRoot}/src/**/*.ts`
|
|
: `--coverage.include=packages/${packageRoot}/*/src/**/*.ts`),
|
|
]
|
|
}
|