test: pin exported skip predicates so knip stays clean

This commit is contained in:
Francisco Ignácio Fontoura Solla 2026-07-31 21:09:20 -03:00
parent 2abcaeaaa5
commit 6c90d76f10

View file

@ -13,16 +13,31 @@ import {
CANONICAL_E2E_TEST_DIR, CANONICAL_E2E_TEST_DIR,
CANONICAL_INT_INCLUDE, CANONICAL_INT_INCLUDE,
CANONICAL_UNIT_INCLUDE, CANONICAL_UNIT_INCLUDE,
E2E_MANIFEST_DOMAIN_EXEMPT,
findMisplacedSpecPaths, findMisplacedSpecPaths,
findUncoveredE2eDomainPrefixes, findUncoveredE2eDomainPrefixes,
HIGH_RISK_EXACT, HIGH_RISK_EXACT,
isBuildPath,
isCanonicalSpecPath, isCanonicalSpecPath,
isCodePath,
isHighRisk,
isMisplacedSpecPath, isMisplacedSpecPath,
isSrcPath,
isTestPath,
} from '../../scripts/lib/test-affected-core.mjs' } from '../../scripts/lib/test-affected-core.mjs'
const repoRoot = join(fileURLToPath(new URL('.', import.meta.url)), '../..') const repoRoot = join(fileURLToPath(new URL('.', import.meta.url)), '../..')
describe('ciSkipInvariants', () => { describe('ciSkipInvariants', () => {
it('exports shared path predicates used by classifiers and the lint guard', () => {
expect(isSrcPath('src/lib/x.ts')).toBe(true)
expect(isTestPath('tests/unit/x.unit.spec.ts')).toBe(true)
expect(isCodePath('tsconfig.json')).toBe(true)
expect(isBuildPath('public/favicon.ico')).toBe(true)
expect(isHighRisk('src/migrations/x.ts')).toBe(true)
expect(E2E_MANIFEST_DOMAIN_EXEMPT.has('shared')).toBe(true)
})
it('rejects misplaced *.spec|*.test files outside the three canonical trees', () => { it('rejects misplaced *.spec|*.test files outside the three canonical trees', () => {
expect(isCanonicalSpecPath('tests/unit/foo.unit.spec.ts')).toBe(true) expect(isCanonicalSpecPath('tests/unit/foo.unit.spec.ts')).toBe(true)
expect(isCanonicalSpecPath('tests/unit/foo.unit.spec.tsx')).toBe(true) expect(isCanonicalSpecPath('tests/unit/foo.unit.spec.tsx')).toBe(true)