Skip to content

Commit 3739d4b

Browse files
kasperisagervdemedes
authored and
vdemedes
committedJan 17, 2016
Close avajs#434 PR: Allow files with only skipped tests
Ensures that skipped tests are also counted when determining whether or not a file contains tests. My own use-case is a multi-file test suite where one or more test files contain nothing but skipped tests due to them testing functionality yet to be implemented.
1 parent ced24c5 commit 3739d4b

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function exit() {
6868
}
6969

7070
globals.setImmediate(function () {
71-
var numberOfTests = runner.select({type: 'test', skipped: false}).length;
71+
var numberOfTests = runner.select({type: 'test'}).length;
7272

7373
if (numberOfTests === 0) {
7474
send('no-tests', {avaRequired: true});

‎test/api.js

+12
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,15 @@ test('caching can be disabled', function (t) {
475475
t.end();
476476
});
477477
});
478+
479+
test('test file with only skipped tests does not create a failure', function (t) {
480+
t.plan(2);
481+
482+
var api = new Api([path.join(__dirname, 'fixture/skip-only.js')]);
483+
484+
api.run()
485+
.then(function () {
486+
t.is(api.tests.length, 1);
487+
t.true(api.tests[0].skip);
488+
});
489+
});

‎test/fixture/skip-only.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import test from '../../';
2+
3+
test.skip(t => {
4+
t.fail();
5+
});

0 commit comments

Comments
 (0)
Please sign in to comment.