This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
v0.3.1
This release includes changes to the internals of lifecycle hooks and the release of the context API.
A context object is now passed along to all lifecycle hooks and to it
blocks. This is a write-one store for any information or helper functions you need to pass between these parts of tests.
Changes since 0.3.0
- Further simplify
beforeAll
handling.beforeAll
now runs on entering the block, rather than on the firstit
encountered after entering the block. The major difference for the moment is that abeforeAll
will now run even if there are noit
blocks under it, which is now consistent with howafterAll
worked.beforeAll
andafterAll
now report errors by creating a dummy node in the results to contain the error. Previously, errors inafterAll
were not reported.- A failure in a
beforeAll
block will now halt all further test execution within its enclosingdescribe
block except for any remainingbeforeAll
blocks and anyafterAll
blocks. MultiplebeforeAll
orafterAll
blocks within onedescribe
block should not count on running in any specific order.afterAll
blocks should account for the possibility of a partially setup state when cleaning up.
- Add a context object visible from lifecycle hooks and
it
blocks. This is a write-once store for whatever you need to communicate between hooks and tests. It can be ignored until you need it.- In particular, you can usually just use upvalues to comminucate between hooks and tests, but that won't work if your hooks are in a separate file (e.g.
init.spec.lua
). - Also, this provides a cleaner alternative to extraEnvironment for passing along helper functions to large numbers of tests as the context can be scoped to particular directories as needed.
- In particular, you can usually just use upvalues to comminucate between hooks and tests, but that won't work if your hooks are in a separate file (e.g.