Files
deepseek-harness/scripts/run-coverage-partitions.ts

31 lines
1.0 KiB
TypeScript

/** CLI entry for partitioned Vitest coverage. */
import { resolve } from 'node:path'
import {
COVERAGE_PARTITIONS_ENV,
COVERAGE_TEST_TIMEOUT_ENV,
CoveragePartitionCoordinator,
coverageTestTimeoutArgs,
forwardedCoverageArgs,
parseCoveragePartitionCount,
} from './coverage-partitions.ts'
const partitions = parseCoveragePartitionCount(process.env[COVERAGE_PARTITIONS_ENV])
if (partitions === undefined) {
throw new Error(`${COVERAGE_PARTITIONS_ENV} is required by partitioned coverage.`)
}
const pnpmEntrypoint = process.env.npm_execpath
if (pnpmEntrypoint === undefined || pnpmEntrypoint === '') {
throw new Error('partitioned coverage must be invoked through a pnpm package script.')
}
const coordinator = new CoveragePartitionCoordinator({
root: resolve(import.meta.dirname, '..'),
partitions,
pnpmEntrypoint,
vitestArgs: [
...coverageTestTimeoutArgs(process.env[COVERAGE_TEST_TIMEOUT_ENV]),
...forwardedCoverageArgs(process.argv.slice(2)),
],
})
process.exitCode = await coordinator.run()