fix(ci): ignore translation records in Cordis config scan
The Loader verifier matched docs/cordis-primer.i18n.yaml solely because its basename contained cordis. Centralize file discovery, exclude i18n sidecars, and cover Loader YAML plus excluded trees with a regression test.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { cordisConfigFiles } from './cordis-config-files.ts'
|
||||
|
||||
const roots: string[] = []
|
||||
|
||||
afterEach(() => {
|
||||
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
describe('cordisConfigFiles', () => {
|
||||
it('finds Loader YAML without treating translation records as configs', () => {
|
||||
const root = mkdtempSync(join(tmpdir(), 'dsh-cordis-config-files-'))
|
||||
roots.push(root)
|
||||
for (const directory of ['.claude', 'docs', 'examples', 'node_modules/pkg', 'vendor/pkg']) {
|
||||
mkdirSync(join(root, directory), { recursive: true })
|
||||
}
|
||||
for (const file of [
|
||||
'.claude/hidden.cordis.yml',
|
||||
'docs/cordis-primer.i18n.yaml',
|
||||
'examples/agent.cordis.yaml',
|
||||
'examples/headless.cordis.yml',
|
||||
'node_modules/pkg/hidden.cordis.yml',
|
||||
'vendor/pkg/hidden.cordis.yml',
|
||||
]) {
|
||||
writeFileSync(join(root, file), '[]\n')
|
||||
}
|
||||
|
||||
expect(cordisConfigFiles(root)).toEqual([
|
||||
'examples/agent.cordis.yaml',
|
||||
'examples/headless.cordis.yml',
|
||||
])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user