I'm looking to run ava programmaticaly, so my script would be able to run some ava tests with a dynamic argument (an URL actually).
My goal is to run programmaticaly the same ava test file on a list of dynamic (from user-input) URL, and then, get back the output.
I know the ava api is a good starting point, but I can see that the official gulp-ava don't use this API, and the API usage is not clear to me.
So, TL;DR :
- How can I run an ava test file from my own nodejs script ?
- How can I pass a dynamic argument to an ava test file, from my script ?
- How can I get back the output from AVA ?
Thanks,
Tom
There is no official API you can use. The best approach would be to run AVA in a child process. The exit code will be
0
if tests pass.Currently you can't pass command line arguments to the test workers. You should provide your URL through an environment variable.