Skip to content

Commit 15bd794

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 only extend timeout if env.AVA_APPVEYOR is set, so we only slow down in our tests.
1 parent b3bc42a commit 15bd794

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ environment:
77
install:
88
- ps: Install-Product node $env:nodejs_version
99
- set CI=true
10+
- set AVA_APPVEYOR=true
1011
- npm -g install npm@latest || (timeout 30 && npm -g install npm@latest)
1112
- set PATH=%APPDATA%\npm;%PATH%
1213
- npm install || (timeout 30 && npm install)

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.AVA_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.AVA_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
@@ -1127,9 +1127,9 @@ test('titles of both passing and failing tests and AssertionErrors are displayed
11271127
test('empty test files creates a failure with a helpful warning', function (t) {
11281128
t.plan(2);
11291129

1130-
execCli('fixture/empty.js', function (err, stdout) {
1130+
execCli('fixture/empty.js', function (err, stdout, stderr) {
11311131
t.ok(err);
1132-
t.ok(/No tests found.*?import "ava"/.test(stdout));
1132+
t.ok(/No tests found.*?import "ava"/.test(stderr));
11331133
t.end();
11341134
});
11351135
});

0 commit comments

Comments
 (0)