Make sure that init.spec.lua runs before any of its children.
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.