* Determines whether to trigger ava by a file change adjacent to a test file. * Considered adjacent when the file changed is in the same directory as one of * the listed test files, or its parent if the directory is named `test`. * @param {string} changedFile * @return {boolean}
(changedFile)
| 27 | * @return {boolean} |
| 28 | */ |
| 29 | function shouldTriggerAva(changedFile) { |
| 30 | if (!targetFiles) { |
| 31 | const thisFile = relative(process.cwd(), __filename); |
| 32 | const patterns = testFiles.map( |
| 33 | (pattern) => dirname(pattern).replace(/\/test$/, '') + '/' |
| 34 | ); |
| 35 | targetFiles = new Set([thisFile, ...globbySync(patterns)]); |
| 36 | } |
| 37 | return targetFiles.has(changedFile); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Runs ava tests. |
no test coverage detected