According to Ava's documentation, I should create a file named test.js
at the root of my project. But having a single file for my tests seems like a recipe for maintenance nightmares. Thus, I want to split my tests into multiple files, all within a folder named tests
and somehow run them from my test.js
file.
For example, let's say we have a test file named ./tests/basic-tests.js
with this code:
import test from ava;
import {Calculator} from calculator;
test('it calculates',t =>{
//Some test here
});
And an another file named ./tests/burn_it_down.js
:
import test from ava;
import {SethRollins} from wwe;
test('Burned it Down',t =>{
//Another tests here
});
I want test.js
to somehow run both the tests in ./tests/basic-tests.js
and in ./tests/burn_it_down.js
. Is there a way to do that?
AVA works with multiple files, too. tests/
isn't in the default search pattern though (test/
is). Assuming you're configuring AVA through the package.json
file you can do:
{
"ava": {
"files": "./tests/*.js"
}
}