Set the key the test's failures are stored under in the database, in
place of the one derived from its location: its file, relative to the
working directory, plus its name ("tests/a.test.ts::property"). A test
function's name is its own, or for an anonymous one the name Vitest or
Jest gives the running test, else the enclosing function's, else its
line. When several hegel.test calls in one runner test or enclosing
function borrow its name, they are numbered in the order their lines
first run in the process, the first keeping the plain key and each later
one carrying its number ("tests/a.test.ts::describe > test (2)"). Such
a key does not depend on which other runner tests ran, but skipping an
earlier call in the same runner test, adding one above it, or moving its
line in a process that keeps Hegel loaded renumbers it; name the test
function or set a key here to keep its saved failures. Where the runtime
has no Error.captureStackTrace (Firefox) there is no call site to
derive a location from: the key is the test function's name, and an
anonymous test has none unless set here.
Add an explicit example: a test case run with the given values before
any generated ones, each value served, in order, to one of the test's
draws in place of a generated value. Explicit examples run in the
Phase.Explicit phase. One that fails fails the test like a generated
failing example does: it is reported, but not shrunk.
Misusing an explicit example throws instead of being reported as a
failing one: rejecting it with tc.assume or tc.reject (explicit test
cases must not be rejected), leaving a value undrawn, making a draw it
has no value for, or calling tc.drawSilent in it. tc.repeat runs its
body once in an explicit example.
Add an explicit example whose values are served to draws by name: each
key is the name a draw is reported under ("draw_1" for the test's first
unnamed draw, or the name passed to TestCase.draw). See
example.
Replay the failure that blob encodes instead of running the test
normally: the blob a failure report prints, with the printBlob setting
on, as how to reproduce it. Call it once for each failure to replay. A
run that replays blobs generates nothing else, and throws a
DidNotReproduceError when none of them fails any more.
Run the test, awaiting an asynchronous test body.
Run the test synchronously. The test body must not be asynchronous.
Set settings over the engine's resolved ones. Returns this for chaining.
Set where the test is defined, in place of the location derived from the
call site. Inside Antithesis, the engine reports the run's verdict as an
always assertion at this location.
A property-based test, configured with builder methods and then run with run (for an asynchronous test body) or runSync.
hegel.testandhegel.testAsyncare shorthands for a test that needs no more than settings.Example