diff --git a/api.js b/api.js index 178845281..9e5d36124 100644 --- a/api.js +++ b/api.js @@ -193,7 +193,7 @@ function handlePaths(files) { files = [ 'test.js', 'test-*.js', - 'test/*.js' + 'test' ]; } @@ -207,7 +207,7 @@ function handlePaths(files) { return files .map(function (file) { if (fs.statSync(file).isDirectory()) { - return handlePaths([path.join(file, '*.js')]); + return handlePaths([path.join(file, '**', '*.js')]); } return file; diff --git a/cli.js b/cli.js index 98414f63b..860358820 100755 --- a/cli.js +++ b/cli.js @@ -48,11 +48,12 @@ var cli = meow([ ' ava', ' ava test.js test2.js', ' ava test-*.js', + ' ava test', ' ava --init', ' ava --init foo.js', '', 'Default patterns when no arguments:', - 'test.js test-*.js test/*.js' + 'test.js test-*.js test/**/*.js' ], { string: [ '_', diff --git a/readme.md b/readme.md index bebfdb0ba..7a16c0489 100644 --- a/readme.md +++ b/readme.md @@ -115,14 +115,15 @@ $ ava --help ava ava test.js test2.js ava test-*.js + ava test ava --init ava --init foo.js Default patterns when no arguments: - test.js test-*.js test/*.js + test.js test-*.js test/**/*.js ``` -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. +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. *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. diff --git a/test/api.js b/test/api.js index b688fe9b0..ddcd689a1 100644 --- a/test/api.js +++ b/test/api.js @@ -259,6 +259,18 @@ test('absolute paths', function (t) { }); }); +test('search directories recursivly for files', function (t) { + t.plan(1); + + var api = new Api([path.join(__dirname, 'fixture/subdir')]); + + api.run() + .then(function () { + t.is(api.passCount, 2); + t.is(api.failCount, 1); + }); +}); + test('titles of both passing and failing tests and AssertionErrors are returned', function (t) { t.plan(3);