NevermoreTestResults
Turns what Jest resolved with into the results table a test run returns.
Deliberately dependency-free: no loader, no Jest, no print or warn. This
logic has produced three bugs — counts read off the wrong table, jest-lua's
inverted success field, and double-counted failed suites — every one of them
shipped green because a module-scope Jest require made it impossible to unit
test. It takes plain tables and returns plain tables so a test can drive it
anywhere, including under Lune (see test/results.test.luau).
The caller does the logging.
Types
TestFailure
interface TestFailure {name: string--
Full test name, or the suite's script path for a suite-level failure
message: string?--
First failure message, truncated
}One failed test, or one suite that failed before its tests could run.
TestRunResults
interface TestRunResults {success: boolean--
Whether the run is a pass
ranJest: boolean--
False for a smoke test, where the counts are all zero because nothing counted
passed: numberfailed: numberskipped: number--
Pending plus todo
total: numbersuitesPassed: numbersuitesFailed: numbersuitesTotal: numberomittedFailures: numbererror: string?--
Why the run failed; absent on a pass
}What a test run produced. Only ever plain strings, numbers, booleans and tables of those: the cloud and the Studio bridge marshal exotic values differently, and this subset survives both unchanged.
Properties
FORMAT
NevermoreTestResults.FORMAT: stringTag identifying a TestRunResults table to whatever reads a run's return values. A test place also runs probe scripts that return whatever they like, so a reader matches on this rather than on the table's shape.
Functions
new
Builds an all-zero passing result. Every other result is this with counts filled in, so a caller never has to handle a missing field.
failed
NevermoreTestResults.failed(ranJest: boolean,message: string--
Why the run failed. Required: a failure with no reason is unreadable.
) → TestRunResultsBuilds a failed result carrying no counts, for a run that never produced any.
fromJest
NevermoreTestResults.fromJest(resolved: any--
The value Jest.runCLI's promise resolved with
) → TestRunResultsReads the verdict and the counts out of whatever Jest.runCLI resolved with.
Fails closed on anything it cannot read. Defaulting an unreadable count to zero instead is what let two wrong reads of this ship: no failures over no tests reads exactly like a clean run.