|
|
@@ -28,6 +28,14 @@ async function temporaryRoot(): Promise<string> {
|
|
|
return await mkdtemp(join(tmpdir(), 'dsh-coverage-partitions-'))
|
|
|
}
|
|
|
|
|
|
+function successfulCommandRecorder(commands: CoverageCommand[]) {
|
|
|
+ return vi.fn(async (command: CoverageCommand) => {
|
|
|
+ commands.push(command)
|
|
|
+ await writeBlob(command)
|
|
|
+ return passed
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
describe('coverage partition count', () => {
|
|
|
it.each([
|
|
|
[undefined, undefined],
|
|
|
@@ -77,11 +85,7 @@ describe('coverage partition coordinator', () => {
|
|
|
it('runs every single-worker partition before one merged threshold check', async () => {
|
|
|
const root = await temporaryRoot()
|
|
|
const commands: CoverageCommand[] = []
|
|
|
- const runCommand = vi.fn(async (command: CoverageCommand) => {
|
|
|
- commands.push(command)
|
|
|
- await writeBlob(command)
|
|
|
- return passed
|
|
|
- })
|
|
|
+ const runCommand = successfulCommandRecorder(commands)
|
|
|
const coordinator = new CoveragePartitionCoordinator({
|
|
|
root,
|
|
|
partitions: 3,
|
|
|
@@ -128,11 +132,7 @@ describe('coverage partition coordinator', () => {
|
|
|
it('runs a native pnpm entrypoint directly', async () => {
|
|
|
const root = await temporaryRoot()
|
|
|
const commands: CoverageCommand[] = []
|
|
|
- const runCommand = vi.fn(async (command: CoverageCommand) => {
|
|
|
- commands.push(command)
|
|
|
- await writeBlob(command)
|
|
|
- return passed
|
|
|
- })
|
|
|
+ const runCommand = successfulCommandRecorder(commands)
|
|
|
const coordinator = new CoveragePartitionCoordinator({
|
|
|
root,
|
|
|
partitions: 2,
|