import {readFile} from 'node:fs/promises'; import {runTask} from './browser.mjs'; const i=process.argv.indexOf('--task'); if(i<0)throw Error('Usage: ./run.command --task task.json [--endpoint http://127.0.0.1:8774]'); const task=JSON.parse(await readFile(process.argv[i+1],'utf8')); const e=process.argv.indexOf('--endpoint'); const {report,browser}=await runTask(task,{endpoint:e>=0?process.argv[e+1]:'http://127.0.0.1:8774'}); await browser.command(['close']); if(report.status!=='completed')process.exitCode=1;