commit 2 refactor
This commit is contained in:
parent
588f666943
commit
32e43c9243
310 changed files with 33318 additions and 31189 deletions
25
scripts/test/coverage-integrity.test.ts
Normal file
25
scripts/test/coverage-integrity.test.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { expect, test } from 'bun:test';
|
||||
import { loadConfig } from '../../tools/coverage-cli/src/config';
|
||||
import { CoverageProcessor } from '../../tools/coverage-cli/src/processor';
|
||||
import { CoverageRunner } from '../../tools/coverage-cli/src/runner';
|
||||
|
||||
test('missing coverage cannot become a passing synthetic percentage', () => {
|
||||
const config = loadConfig({ threshold: 80 });
|
||||
const processor = new CoverageProcessor(config);
|
||||
const report = processor.process({ files: [] }, []);
|
||||
expect(report.overall.lines.percentage).toBe(0);
|
||||
expect(processor.checkThresholds(report).passed).toBe(false);
|
||||
});
|
||||
|
||||
test('requesting no existing packages is a failed coverage run', async () => {
|
||||
const config = loadConfig({ packages: ['__missing_coverage_fixture__'] });
|
||||
const result = await new CoverageRunner(config).run();
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.coverage.files).toEqual([]);
|
||||
});
|
||||
|
||||
test('coverage configuration does not mutate defaults and rejects unknown reporters', () => {
|
||||
expect(loadConfig({ thresholdLines: 17 }).thresholds.lines).toBe(17);
|
||||
expect(loadConfig({}).thresholds.lines).toBe(80);
|
||||
expect(() => loadConfig({ reporters: ['not-a-reporter'] })).toThrow('Unknown coverage reporter');
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue