ci: make coverage filters path-exact
This commit is contained in:
@@ -28,11 +28,14 @@ describe('coverage shards', () => {
|
|||||||
it.each(coverageShards)('selects tests and source includes for $name', (shard) => {
|
it.each(coverageShards)('selects tests and source includes for $name', (shard) => {
|
||||||
const args = coverageArgs(shard.name)
|
const args = coverageArgs(shard.name)
|
||||||
for (const packageRoot of shard.packageRoots) {
|
for (const packageRoot of shard.packageRoots) {
|
||||||
expect(args).toContain(`packages/${packageRoot}`)
|
expect(args).toContain(`packages/${packageRoot}/`)
|
||||||
expect(args).toContain(packageRoot.includes('/')
|
expect(args).toContain(packageRoot.includes('/')
|
||||||
? `--coverage.include=packages/${packageRoot}/src/**/*.ts`
|
? `--coverage.include=packages/${packageRoot}/src/**/*.ts`
|
||||||
: `--coverage.include=packages/${packageRoot}/*/src/**/*.ts`)
|
: `--coverage.include=packages/${packageRoot}/*/src/**/*.ts`)
|
||||||
}
|
}
|
||||||
|
if ('extraTestRoots' in shard) {
|
||||||
|
for (const testRoot of shard.extraTestRoots) expect(args).toContain(`${testRoot}/`)
|
||||||
|
}
|
||||||
expect(args).toContain('scripts/test-invariants.spec.ts')
|
expect(args).toContain('scripts/test-invariants.spec.ts')
|
||||||
expect(new Set(args).size).toBe(args.length)
|
expect(new Set(args).size).toBe(args.length)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -98,9 +98,11 @@ export function coverageArgs(name: string): string[] {
|
|||||||
throw new Error(`run-gates: unknown DSH_COVERAGE_SHARD ${JSON.stringify(name)}.`)
|
throw new Error(`run-gates: unknown DSH_COVERAGE_SHARD ${JSON.stringify(name)}.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Vitest positional filters are substrings; the trailing separator keeps
|
||||||
|
// prefix-named sibling packages out of each lane.
|
||||||
const testRoots = new Set([
|
const testRoots = new Set([
|
||||||
...shard.packageRoots.map(packageRoot => `packages/${packageRoot}`),
|
...shard.packageRoots.map(packageRoot => `packages/${packageRoot}/`),
|
||||||
...('extraTestRoots' in shard ? shard.extraTestRoots : []),
|
...('extraTestRoots' in shard ? shard.extraTestRoots.map(testRoot => `${testRoot}/`) : []),
|
||||||
'scripts/test-invariants.spec.ts',
|
'scripts/test-invariants.spec.ts',
|
||||||
])
|
])
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user