Skip to content

Commit 9611e2f

Browse files
committed
extend exit delay on AppVeyor
add small delay on exit from babel (cherry picked from commit 11961f7) if AVA is not required in a test, throw an error instead of process.exit
1 parent fc37113 commit 9611e2f

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function flushIoAndExit(code) {
183183
// timeout required to correctly flush io on Node 0.10 Windows
184184
setTimeout(function () {
185185
process.exit(code);
186-
}, 0);
186+
}, process.env.APPVEYOR ? 500 : 0);
187187
}
188188

189189
function init(files) {

lib/babel.js

Lines changed: 4 additions & 5 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) {
@@ -62,7 +59,9 @@ process.on('message', function (message) {
6259
});
6360

6461
process.on('ava-kill', function () {
65-
process.exit(0);
62+
setTimeout(function () {
63+
process.exit(0);
64+
}, process.env.APPVEYOR ? 100 : 0);
6665
});
6766

6867
process.on('ava-cleanup', function () {

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)