Skip to content

Commit 94c03f6

Browse files
Juan Sotosindresorhus
authored andcommitted
Close #600 PR: Fix AVA hanging when test is used incorrectly. Fixes #574
1 parent 94b352c commit 94c03f6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ optionChain(chainableMethods, function (opts, title, fn) {
6363
if (typeof title !== 'string') {
6464
throw new TypeError('`todo` tests require a title');
6565
}
66-
} else if (opts.skipped && typeof fn !== 'function') {
66+
} else if (typeof fn !== 'function') {
6767
throw new TypeError('Expected a function. Use `test.todo()` for tests without a function.');
6868
}
6969

test/runner.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ test('skip test', function (t) {
203203
});
204204
});
205205

206+
test('test throws when given no function', function (t) {
207+
t.plan(1);
208+
209+
var runner = new Runner();
210+
211+
t.throws(function () {
212+
runner.test();
213+
}, {message: 'Expected a function. Use `test.todo()` for tests without a function.'});
214+
});
215+
206216
test('todo test', function (t) {
207217
t.plan(5);
208218

0 commit comments

Comments
 (0)