-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: improve test runner and testsuite isolation (#2016)
- initial LUA paths are now setup by the runner itself, so it can be executed directly without needing to manually set them before - patch the LUA paths before actually executing the tests to remove the testsuite specific entries (e.g. `spec/rocks/…`), ensuring tests only have access to shipped packages
- Loading branch information
1 parent
c844e4b
commit 7ecda58
Showing
7 changed files
with
32 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Preload necessary busted modules and their dependencies (which | ||
-- are normally dynamically loaded during the testsuite execution). | ||
require("pl.dir") | ||
require("busted.execute") | ||
require("busted.modules.files.lua") | ||
require("busted.modules.test_file_loader") | ||
-- Patch `package.path / package.cpath`: filter-out paths | ||
-- specific to the test framework (e.g. `spec/rocks/…`). | ||
local function filter_rocks(path) | ||
local filtered = {} | ||
for spec in string.gmatch(path, "([^;]+)") do | ||
if not spec:match("spec/rocks/") then | ||
table.insert(filtered, spec) | ||
end | ||
end | ||
return table.concat(filtered, ';') | ||
end | ||
package.path = filter_rocks(package.path) | ||
package.cpath = filter_rocks(package.cpath) | ||
-- Setup `ffi.loadlib` support. | ||
require("ffi/loadlib") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters