import test from 'node:test' import assert from 'node:assert/strict' import { execFile } from 'node:child_process' import { mkdir, readFile, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { tmpdir } from 'node:os' import { mkdtemp } from 'node:fs/promises' import { promisify } from 'node:util' const exec = promisify(execFile) const cli = new URL('../src/cli.js', import.meta.url).pathname test('CLI runs scan, plan, run, diff, and verify against one prototype', async () => { const cwd = await mkdtemp(join(tmpdir(), 'ht-e2e-')) await mkdir(join(cwd, 'packages/prototype'), { recursive: true }) await mkdir(join(cwd, 'packages/web/src'), { recursive: true }) await mkdir(join(cwd, 'packages/api'), { recursive: true }) await writeFile(join(cwd, 'packages/prototype/index.html'), `

Customer Portal

`) await writeFile(join(cwd, 'packages/web/src/App.vue'), '') await writeFile(join(cwd, 'packages/api/openapi.json'), '{"openapi":"3.0.0","paths":{}}') await writeFile(join(cwd, 'ht.config.js'), ` export default { plan: { interactiveReview: false }, project: { qualityCommands: {} } } `) for (const command of ['scan', 'plan', 'run', 'diff', 'verify']) { await exec('node', [cli, command], { cwd }) } const component = await readFile(join(cwd, 'packages/result/index/main-1.vue'), 'utf8') const report = JSON.parse(await readFile(join(cwd, '.ht/verify/verification-report.json'), 'utf8')) assert.match(component, /Customer Portal/) assert.match(component, /v-text-field/) assert.equal(report.domChecks.status, 'passed') })