Avant Runtime is a library used to run unit tests on Roblox. For the plugin, see Avant-Plugin.
This is the successor to Nexus Unit Testing.
describe, it, and others, as well as properly starting tests with the
developer-provied runtime.
Avant exists to provide the following:
- Provide a common interface that can be used with multiple test libraries (TestEZ, Jest).
- Improve test isolation and re-running by allowing
ModuleScripts to berequired multiple times. - Isolate and store the output of individual tests.
For TestEZ, see TestEZ's docs.
In order for tests to be detected, the name of the ModuleScript must
end with .spec.
This is not relevant for the plugin.
Avant provides a simple test runner for quick testing with RunTests.
It can be used as a reference for custom runners.
local RunTests = require(game:GetService("TestService").AvantRuntime.RunTests) --Replace with where the module is.
local Results = RunTests() --Returns a table with the total NOT_RUN, PASSED, FAILED, and SKIPPED tests.Tests can be ignored by runners, such as tests bundled with Wally packages. For example, if you have tests like the following:
ReplicatedStorage
> Packages
> SomePackage1
> SomePackage2
> SomeFolder
To ignore tests in ReplicatedStorage.Packages, a StringValue named
AvantIgnoredPaths can be stored in any location with a JSON list of
string paths, such as {"ReplicatedStorage.Packages"}. This uses string.find,
so patterns are accepted. {"Packages"} would also work, but might filter
out unintended paths.
Avant Runtime is available under the terms of the MIT License. See LICENSE for details.