What one script run produced.
const result: ScriptResult = { ok: false, exitCode: 3, durationMs: 412, file: '/proj/scripts/seed.ts', value: { seeded: 3 }, valueProblem: null, tests: null, browserLogs: [{ type: 'log', text: 'seeding…', args: [] }], browserLogsDropped: 0, }; result.ok; // false — the script set a non-zero globalThis.exitCode result.browserLogs[0].text; // 'seeding…' — what it printed, whatever `console` you passed
ok: boolean
True when the script finished with exit code 0.
exitCode: number
globalThis.exitCode if the script set one, 1 if it threw, else 0.
durationMs: number
Wall-clock ms from the first bundle to the script's top level settling.
file: string
Absolute path of the file that ran.
value: unknown
The script's export default, or undefined when it has none.
A module cannot return, so this is the only way a script hands a value back. What arrives is
JSON-safe by construction: the value is checked in the page before it crosses, and one that
would arrive changed — a Map as {}, a Date as a string, a dropped function — is withheld
rather than altered. Return plain data if you mean to read this.
valueProblem: string | null
Why ScriptResult.value is undefined even though the script exported something, or
null when there is nothing to explain — including when it exported nothing at all.
Reads like 'index is a Map' or 'the value is a function' — the field named, rather than
silently handed back as {}. Reading it is optional and ignoring it is fine: a script whose
default export is a main() function is an ordinary script, not a broken one, so this never
affects ScriptResult.ok.
The suite the file declared, or null when it was a plain script.
A file that registers QUnit tests is a suite whichever verb points at it, so run runs it as
one — same page, same evaluation, same reporters as test. Reporting it as an empty
script run would be reporting success for tests that never ran.
When this is non-null, ScriptResult.ok and ScriptResult.exitCode are the
suite's verdict rather than globalThis.exitCode.
Everything the script printed — its console calls and any uncaught error — in emit order,
whatever console option was passed. The same shape a test run reports, capped the same way.
browserLogsDropped: number
How many lines were dropped to stay under the cap. 0 when nothing was.