Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Passing arguments to your test files

Translations: Français

You can pass command line arguments to your test files. Use the -- argument terminator to separate AVA's arguments from your own:

// test.js
import test from 'ava';

test('argv', t => {
	t.deepEqual(process.argv.slice(2), ['--hello', 'world']);
});
$ npx ava -- --hello world

You need two -- argument terminators if you're invoking AVA through an npm test script:

{
	"scripts": {
		"test": "ava"
	}
}
$ npm test -- -- --hello world