Skip to content

Commit 96930e3

Browse files
committed
Merge pull request #378 from ariporad/recursive
Deeply recurse directories
2 parents fc3b969 + 72e87d9 commit 96930e3

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function handlePaths(files) {
193193
files = [
194194
'test.js',
195195
'test-*.js',
196-
'test/*.js'
196+
'test'
197197
];
198198
}
199199

@@ -207,7 +207,7 @@ function handlePaths(files) {
207207
return files
208208
.map(function (file) {
209209
if (fs.statSync(file).isDirectory()) {
210-
return handlePaths([path.join(file, '*.js')]);
210+
return handlePaths([path.join(file, '**', '*.js')]);
211211
}
212212

213213
return file;

cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ var cli = meow([
4848
' ava',
4949
' ava test.js test2.js',
5050
' ava test-*.js',
51+
' ava test',
5152
' ava --init',
5253
' ava --init foo.js',
5354
'',
5455
'Default patterns when no arguments:',
55-
'test.js test-*.js test/*.js'
56+
'test.js test-*.js test/**/*.js'
5657
], {
5758
string: [
5859
'_',

readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,15 @@ $ ava --help
115115
ava
116116
ava test.js test2.js
117117
ava test-*.js
118+
ava test
118119
ava --init
119120
ava --init foo.js
120121
121122
Default patterns when no arguments:
122-
test.js test-*.js test/*.js
123+
test.js test-*.js test/**/*.js
123124
```
124125

125-
Files in directories named `fixtures` and `helpers` are ignored, as well as files starting with `_`. This can be useful for having helpers in the same directory as your test files.
126+
Directories are recursive by default. Files in directories named `fixtures` and `helpers` are ignored, as well as files starting with `_`. This can be useful for having helpers in the same directory as your test files.
126127

127128
*WARNING: NON-STANDARD BEHAVIOR:* The AVA CLI will always try to find and use your projects local install of AVA. This is true even when you run the global `ava` command. This non-standard behavior solves an important [issue](https://github.com/sindresorhus/ava/issues/157), and should have no impact on everyday use.
128129

test/api.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,18 @@ test('absolute paths', function (t) {
259259
});
260260
});
261261

262+
test('search directories recursivly for files', function (t) {
263+
t.plan(1);
264+
265+
var api = new Api([path.join(__dirname, 'fixture/subdir')]);
266+
267+
api.run()
268+
.then(function () {
269+
t.is(api.passCount, 2);
270+
t.is(api.failCount, 1);
271+
});
272+
});
273+
262274
test('titles of both passing and failing tests and AssertionErrors are returned', function (t) {
263275
t.plan(3);
264276

0 commit comments

Comments
 (0)