Skip to content

Make directories recursive. #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ function handlePaths(files) {
if (files.length === 0) {
files = [
'test.js',
'**/test.js',
'test-*.js',
'test/*.js'
'**/test-*.js',
'test'
];
}

Expand All @@ -203,7 +205,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;
Expand Down
11 changes: 11 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ test('absolute paths', function (t) {
});
});

test('recursive for directory', function (t) {
t.plan(1);

var api = new Api([path.join(__dirname, 'fixture/subdir/in-a-subdir.js')]);

api.run()
.then(function () {
t.is(api.passCount, 1);
});
});

test('titles of both passing and failing tests and AssertionErrors are returned', function (t) {
t.plan(3);

Expand Down
5 changes: 5 additions & 0 deletions test/fixture/subdir/in-a-subdir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var test = require('../../../');

test(function (t) {
t.pass();
});