cmvr-wms/scripts/projectdev/vue3-test-runner.cjs

19 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

const fs = require('node:fs')
const path = require('node:path')
const { spawnSync } = require('node:child_process')
const selected = process.argv.slice(2)
const files = fs.readdirSync(__dirname).filter(file => /^vue3-.*(?:check|regression)\.cjs$/.test(file)
&& (!selected.length || selected.some(name => file.includes(name))))
if (!files.length) { console.error('No matching Vue3 UI checks'); process.exit(1) }
const results = [], output = path.resolve(__dirname, '../../.codex-tmp/full-flow-audit')
fs.mkdirSync(output, { recursive: true })
for (const file of files) {
console.log('\nRUN ' + file)
const start = Date.now()
const result = spawnSync(process.execPath, [path.join(__dirname, file)], { stdio: 'inherit', env: process.env })
results.push({ file, status: result.status === 0 ? 'PASS' : 'FAIL', seconds: (Date.now() - start) / 1000 })
fs.writeFileSync(path.join(output, 'ui-results.json'), JSON.stringify({ at: new Date().toISOString(), selected: files.length, results }, null, 2))
if (result.status !== 0) process.exit(result.status || 1)
}
console.log('\nPASS ' + files.length + ' Vue3 checks')