See #11.
File resolution for AVA
$ npm install --save ava-files
const AvaFiles = require('ava-files');
const avaFiles = new AvaFiles({
cwd: '/path/to/cwd',
files: ['**/glob/patterns/**'],
sources: ['**/glob/patterns/**']
});
avaFiles.isTest(filePath);
//=> true or false
avaFiles.isSource(filePath);
//=> true or false
avaFiles.findTestFiles().then(files => {
// files is an array of found test files
});
avaFiles.findTestHelpers().then(files => {
// files is an array of found test helpers
});
Type: Array
of string
glob patterns
Default:
[
'test.js',
'test-*.js',
'test',
'**/__tests__',
'**/*.test.js',
'!**/node_modules/**',
'!**/fixtures/**',
'!**/helpers/**'
]
Type: Array
of string
glob patterns
Default: []
Type: string
Default: process.cwd()
The base directory to search for files from.
Validate if filePath
is a test file.
Type: string
Path to the file.
Validate if filePath
is a source file.
Type: string
Path to the file.
Returns a Promise
for an Array
of string
paths to the found test files.
Returns a Promise
for an Array
of string
paths to the found helper files.
MIT © James Talmage