import { spawnSync } from 'node:child_process'; import { createRequire } from 'node:module'; import { join } from 'node:path'; import { fileURLToPath } from 'node:url'; import { describe, expect, it } from 'vitest'; /** * The Aula page's words are read by strangers, like a store listing (CLAUDE.md ยง8), so * lint:copy must read them (fabrica-release.md F11). The rules themselves are tested in * @rosea/content; this proves the files are in the list the script checks. */ const repo = fileURLToPath(new URL('../../../', import.meta.url)); const tsx = createRequire(join(repo, 'package.json')).resolve('tsx/cli'); function listed(): string[] { const run = spawnSync(process.execPath, [tsx, join(repo, 'scripts/lint-copy.ts'), '--list'], { cwd: repo, encoding: 'utf8' }); expect(run.status, run.stderr).toBe(0); return run.stdout.split(/\r?\n/).filter(Boolean); } describe('lint:copy reads the Aula page', { timeout: 60_000 }, () => { it('AULA.md, the brief and every release note are checked', () => { const files = listed(); expect(files).toContain('AULA.md'); expect(files).toContain('.fabrica/aula/brief.md'); expect(files).toContain('.fabrica/notes/0.1.0.md'); }); it('the game itself is still checked', () => { const files = listed(); expect(files).toContain('packages/ui/src/copy/en.ts'); expect(files).toContain('docs/LETTER.md'); }); });