tests(busted): make all setup() and teardown() calls lazy #13984
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the
lazy
setting to our.busted
file. This is the equivalent of adding the--lazy
flag when running the busted CLI, which essentially causes everysetup()
andteardown()
invocation to behave likelazy_setup()
andlazy_teardown()
.We have a bunch of test files that are using
setup()
/teardown()
instead of thelazy_
variants, and making one small change to the.busted
file saves us the trouble of updating all of them (including EE).setup()
always runs, whereaslazy_setup()
only runs if at least one test case (it(...)
) is scheduled to run:We commonly filter out tests with the
--exclude-tags
CLI option in CI. Thestrict
behavior is not ideal in this case, because it means that expensive setup/teardown tasks run even if we've completely filtered out all accompanied tests:If any test authors specifically need the strictness of
setup()
/teardown()
, they can usestrict_setup()
/strict_teardown()
:https://lunarmodules.github.io/busted/#defining-tests
KAG-5962