You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
One case we want to support for TestEZ is allowing configuration to be done per test suite. init.spec.lua was added to provide a place to run such configuration code. But to be useful, it has to run before any of the spec files under it, which isn't currently guaranteed. An additional wrinkle here is that while it intuitively makes the most sense to do this inside a beforeAll block, that will mean the configuration definitely won't get set for any describe blocks under it, though it will currently work for any it blocks.
For example, if you want to set the global config of a library for all tests inside the foo directory, you should be able to put the following in foo/init.spec.lua
return function()
local originalThing
beforeAll(function()
originalThing = myLibrary.config.useNewThing
myLibrary.config.useNewThing = true
end)
afterAll(function()
myLibrary.config.useNewThing = originalThing
end)
end
While the use of beforeAll and afterAll are intuitively the way to go, we at least need to make sure there's some solution that's guaranteed to work.
The text was updated successfully, but these errors were encountered:
One case we want to support for TestEZ is allowing configuration to be done per test suite. init.spec.lua was added to provide a place to run such configuration code. But to be useful, it has to run before any of the spec files under it, which isn't currently guaranteed. An additional wrinkle here is that while it intuitively makes the most sense to do this inside a
beforeAll
block, that will mean the configuration definitely won't get set for anydescribe
blocks under it, though it will currently work for anyit
blocks.For example, if you want to set the global config of a library for all tests inside the
foo
directory, you should be able to put the following in foo/init.spec.luaWhile the use of
beforeAll
andafterAll
are intuitively the way to go, we at least need to make sure there's some solution that's guaranteed to work.The text was updated successfully, but these errors were encountered: