Skip to content

Commit afe028a

Browse files
authored
CI updates
* Use Travis CI to test on Windows * Reorganize test script * Run TAP tests in parallel once more * Slow down timeout tests to prevent them from timing out too quickly in CI * Add Node.js 11 to the test matrix * Simplify .gitattributes
1 parent 1ba31d8 commit afe028a

File tree

12 files changed

+43
-63
lines changed

12 files changed

+43
-63
lines changed

.gitattributes

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf
32
*.ai binary
43
*.psd binary

.travis.yml

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
language: node_js
2+
os:
3+
- windows
4+
- linux
25
node_js:
6+
- 11
37
- 10
48
- 8
59
- 6
@@ -8,26 +12,34 @@ env:
812
- FRESH_DEPS=true
913
matrix:
1014
exclude:
15+
- node_js: 11
16+
env: FRESH_DEPS=true
1117
- node_js: 8
1218
env: FRESH_DEPS=true
1319
- node_js: 6
1420
env: FRESH_DEPS=true
15-
cache:
16-
directories:
17-
- $HOME/.npm
18-
before_install:
19-
- npm install --global npm@6.3.0
20-
- npm --version
21-
install: |
21+
- node_js: 10
22+
env: FRESH_DEPS=true # Assume any bugs that occur with fresh dependencies are not platform specific.
23+
os: windows
24+
- node_js: 6
25+
os: windows # npm install --global currently fails on Windows. Skip the tests entirely instead.
26+
cache: npm
27+
before_install: if [[ $(node -pe "process.versions.node.split('.')[0]") == "6" ]]; then npm install --global npm@6; fi
28+
install: npm ci
29+
before_script: |
2230
if [[ ${FRESH_DEPS} == "true" ]]; then
23-
npm install --no-shrinkwrap --prefer-online;
31+
npm install --no-shrinkwrap --prefer-online
2432
else
25-
npm ci;
26-
checksum=$(md5sum package-lock.json);
27-
npm install --package-lock-only;
33+
checksum=$(md5sum package-lock.json)
34+
npm install --package-lock-only
2835
if ! echo ${checksum} | md5sum --quiet -c -; then
29-
echo "package-lock.json was modified unexpectedly. Please rebuild it using npm@$(npm -v) and commit the changes.";
30-
exit 1;
36+
echo "package-lock.json was modified unexpectedly. Please rebuild it using npm@$(npm -v) and commit the changes."
37+
exit 1
3138
fi
3239
fi
40+
41+
if [[ "${TRAVIS_OS_NAME}" == 'windows' ]]; then
42+
git config core.symlinks true
43+
git reset --hard
44+
fi
3345
after_success: npx codecov --file=./coverage/lcov.info

appveyor.yml

-33
This file was deleted.

maintaining.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Read and adhere to the [Code of Conduct](code-of-conduct.md).
1717
## Release process
1818

1919
- Bump dependencies.
20-
- Ensure [Travis CI](https://travis-ci.org/avajs/ava) and [AppVeyor](https://ci.appveyor.com/project/avajs/ava/branch/master) are green.
20+
- Ensure [Travis CI](https://travis-ci.org/avajs/ava) is green.
2121
- If [necessary](docs/support-statement.md), update the `engines` field in `package.json`
2222
- Publish a new version using [`np`](https://github.com/sindresorhus/np) with a version number according to [semver](http://semver.org).
2323
- Write a [release note](https://github.com/avajs/ava/releases/new) following the style of previous release notes.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
},
1212
"scripts": {
1313
"lint": "xo",
14-
"test": "npm run lint && flow check test/flow-types && tsc --noEmit -p test/ts-types && nyc tap --no-cov --timeout=300 test/*.js test/reporters/*.js test/integration/*.js",
15-
"test-win": "tap --no-cov --reporter=classic --timeout=300 test/*.js test/reporters/*.js test/integration/*.js"
14+
"test:flow": "flow check test/flow-types",
15+
"test:tap": "tap --no-cov --reporter=classic --timeout=300 --jobs=2 test/*.js test/reporters/*.js test/integration/*.js",
16+
"test:typescript": "tsc --noEmit -p test/ts-types",
17+
"test": "npm run lint && npm run test:flow && npm run test:typescript && nyc npm run test:tap"
1618
},
1719
"files": [
1820
"lib",

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Futuristic test runner
44
5-
[![Build Status: Linux](https://travis-ci.org/avajs/ava.svg?branch=master)](https://travis-ci.org/avajs/ava) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/e7v91mu2m5x48ehx/branch/master?svg=true)](https://ci.appveyor.com/project/ava/ava/branch/master) [![Coverage Status](https://codecov.io/gh/avajs/ava/branch/master/graph/badge.svg)](https://codecov.io/gh/avajs/ava/branch/master) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/ava)
5+
[![Build Status](https://travis-ci.org/avajs/ava.svg?branch=master)](https://travis-ci.org/avajs/ava) [![Coverage Status](https://codecov.io/gh/avajs/ava/branch/master/graph/badge.svg)](https://codecov.io/gh/avajs/ava/branch/master) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/ava)
66
[![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)
77

88
Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature. AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file. [Switching](https://github.com/sindresorhus/pageres/commit/663be15acb3dd2eb0f71b1956ef28c2cd3fdeed0) from Mocha to AVA in Pageres brought the test time down from 31 to 11 seconds. Having tests run concurrently forces you to write atomic tests, meaning tests don't depend on global state or the state of other tests, which is a great thing!

test/fixture/report/timeoutinmultiplefiles/a.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import test from '../../../..';
33
test('a passes', t => t.pass());
44

55
test.cb('a slow', t => {
6-
setTimeout(t.end, 5000);
6+
setTimeout(t.end, 15000);
77
});
88
test.cb('a slow two', t => {
9-
setTimeout(t.end, 5000);
9+
setTimeout(t.end, 15000);
1010
});
1111

1212
test('a passes two', t => t.pass());

test/fixture/report/timeoutinmultiplefiles/b.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import test from '../../../..';
33
test('b passes', t => t.pass());
44

55
test.cb('b slow', t => {
6-
setTimeout(t.end, 5000);
6+
setTimeout(t.end, 15000);
77
});
88
test.cb('b slow two', t => {
9-
setTimeout(t.end, 5000);
9+
setTimeout(t.end, 15000);
1010
});
1111
test.cb('b slow three', t => {
12-
setTimeout(t.end, 5000);
12+
setTimeout(t.end, 15000);
1313
});
1414

1515
test('b passes two', t => t.pass());

test/fixture/report/timeoutinsinglefile/a.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import test from '../../../..';
33
test('passes', t => t.pass());
44

55
test.cb('slow', t => {
6-
setTimeout(t.end, 5000);
6+
setTimeout(t.end, 15000);
77
});
88
test.cb('slow two', t => {
9-
setTimeout(t.end, 5000);
9+
setTimeout(t.end, 15000);
1010
});
1111

1212
test('passes two', t => t.pass());

test/helper/report.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const run = (type, reporter) => {
9797
babelConfig: {testOptions: {}},
9898
resolveTestsFrom: projectDir,
9999
projectDir,
100-
timeout: type.startsWith('timeout') ? '1000ms' : undefined,
100+
timeout: type.startsWith('timeout') ? '10s' : undefined,
101101
concurrency: 1,
102102
updateSnapshots: false,
103103
snapshotDir: false,

test/reporters/verbose.timeoutinmultiplefiles.log

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
✔ a › a passes two
66
---tty-stream-chunk-separator
77

8-
✖ Exited because no new tests completed within the last 1000ms of inactivity
8+
✖ Exited because no new tests completed within the last 10000ms of inactivity
99

1010
2 tests still running in ~/test/fixture/report/timeoutinmultiplefiles/a.js:
1111

@@ -18,7 +18,7 @@
1818
✔ b › b passes two
1919
---tty-stream-chunk-separator
2020

21-
✖ Exited because no new tests completed within the last 1000ms of inactivity
21+
✖ Exited because no new tests completed within the last 10000ms of inactivity
2222

2323
3 tests still running in ~/test/fixture/report/timeoutinmultiplefiles/b.js:
2424

test/reporters/verbose.timeoutinsinglefile.log

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
✔ passes two
66
---tty-stream-chunk-separator
77

8-
✖ Exited because no new tests completed within the last 1000ms of inactivity
8+
✖ Exited because no new tests completed within the last 10000ms of inactivity
99

1010
2 tests still running in ~/test/fixture/report/timeoutinsinglefile/a.js:
1111

0 commit comments

Comments
 (0)