Skip to content

Commit 6585856

Browse files
committed
if AVA is not required in a test, throw an error instead of process.exit
1 parent 808aa20 commit 6585856

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

lib/babel.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ requireFromString(transpiled.code, testPath, {
4848
});
4949

5050
if (!avaRequired) {
51-
console.error('No tests found in ' + testPath + ', make sure to import "ava" at the top of your test file');
52-
setImmediate(function () {
53-
process.exit(1);
54-
});
51+
throw new Error('No tests found in ' + testPath + ', make sure to import "ava" at the top of your test file');
5552
}
5653

5754
process.on('message', function (message) {

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,9 +1109,9 @@ test('titles of both passing and failing tests and AssertionErrors are displayed
11091109
test('empty test files creates a failure with a helpful warning', function (t) {
11101110
t.plan(2);
11111111

1112-
execCli('fixture/empty.js', function (err, stdout) {
1112+
execCli('fixture/empty.js', function (err, stdout, stderr) {
11131113
t.ok(err);
1114-
t.ok(/No tests found.*?import "ava"/.test(stdout));
1114+
t.ok(/No tests found.*?import "ava"/.test(stderr));
11151115
t.end();
11161116
});
11171117
});

0 commit comments

Comments
 (0)