Skip to content

Commit

Permalink
CI updates
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
novemberborn authored Nov 5, 2018
1 parent 1ba31d8 commit afe028a
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 63 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
*.ai binary
*.psd binary
38 changes: 25 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: node_js
os:
- windows
- linux
node_js:
- 11
- 10
- 8
- 6
Expand All @@ -8,26 +12,34 @@ env:
- FRESH_DEPS=true
matrix:
exclude:
- node_js: 11
env: FRESH_DEPS=true
- node_js: 8
env: FRESH_DEPS=true
- node_js: 6
env: FRESH_DEPS=true
cache:
directories:
- $HOME/.npm
before_install:
- npm install --global npm@6.3.0
- npm --version
install: |
- node_js: 10
env: FRESH_DEPS=true # Assume any bugs that occur with fresh dependencies are not platform specific.
os: windows
- node_js: 6
os: windows # npm install --global currently fails on Windows. Skip the tests entirely instead.
cache: npm
before_install: if [[ $(node -pe "process.versions.node.split('.')[0]") == "6" ]]; then npm install --global npm@6; fi
install: npm ci
before_script: |
if [[ ${FRESH_DEPS} == "true" ]]; then
npm install --no-shrinkwrap --prefer-online;
npm install --no-shrinkwrap --prefer-online
else
npm ci;
checksum=$(md5sum package-lock.json);
npm install --package-lock-only;
checksum=$(md5sum package-lock.json)
npm install --package-lock-only
if ! echo ${checksum} | md5sum --quiet -c -; then
echo "package-lock.json was modified unexpectedly. Please rebuild it using npm@$(npm -v) and commit the changes.";
exit 1;
echo "package-lock.json was modified unexpectedly. Please rebuild it using npm@$(npm -v) and commit the changes."
exit 1
fi
fi
if [[ "${TRAVIS_OS_NAME}" == 'windows' ]]; then
git config core.symlinks true
git reset --hard
fi
after_success: npx codecov --file=./coverage/lcov.info
33 changes: 0 additions & 33 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion maintaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Read and adhere to the [Code of Conduct](code-of-conduct.md).
## Release process

- Bump dependencies.
- Ensure [Travis CI](https://travis-ci.org/avajs/ava) and [AppVeyor](https://ci.appveyor.com/project/avajs/ava/branch/master) are green.
- Ensure [Travis CI](https://travis-ci.org/avajs/ava) is green.
- If [necessary](docs/support-statement.md), update the `engines` field in `package.json`
- Publish a new version using [`np`](https://github.com/sindresorhus/np) with a version number according to [semver](http://semver.org).
- Write a [release note](https://github.com/avajs/ava/releases/new) following the style of previous release notes.
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
},
"scripts": {
"lint": "xo",
"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",
"test-win": "tap --no-cov --reporter=classic --timeout=300 test/*.js test/reporters/*.js test/integration/*.js"
"test:flow": "flow check test/flow-types",
"test:tap": "tap --no-cov --reporter=classic --timeout=300 --jobs=2 test/*.js test/reporters/*.js test/integration/*.js",
"test:typescript": "tsc --noEmit -p test/ts-types",
"test": "npm run lint && npm run test:flow && npm run test:typescript && nyc npm run test:tap"
},
"files": [
"lib",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Futuristic test runner
[![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)
[![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)
[![Mentioned in Awesome Node.js](https://awesome.re/mentioned-badge.svg)](https://github.com/sindresorhus/awesome-nodejs)

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!
Expand Down
4 changes: 2 additions & 2 deletions test/fixture/report/timeoutinmultiplefiles/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import test from '../../../..';
test('a passes', t => t.pass());

test.cb('a slow', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});
test.cb('a slow two', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});

test('a passes two', t => t.pass());
6 changes: 3 additions & 3 deletions test/fixture/report/timeoutinmultiplefiles/b.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import test from '../../../..';
test('b passes', t => t.pass());

test.cb('b slow', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});
test.cb('b slow two', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});
test.cb('b slow three', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});

test('b passes two', t => t.pass());
4 changes: 2 additions & 2 deletions test/fixture/report/timeoutinsinglefile/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import test from '../../../..';
test('passes', t => t.pass());

test.cb('slow', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});
test.cb('slow two', t => {
setTimeout(t.end, 5000);
setTimeout(t.end, 15000);
});

test('passes two', t => t.pass());
2 changes: 1 addition & 1 deletion test/helper/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const run = (type, reporter) => {
babelConfig: {testOptions: {}},
resolveTestsFrom: projectDir,
projectDir,
timeout: type.startsWith('timeout') ? '1000ms' : undefined,
timeout: type.startsWith('timeout') ? '10s' : undefined,
concurrency: 1,
updateSnapshots: false,
snapshotDir: false,
Expand Down
4 changes: 2 additions & 2 deletions test/reporters/verbose.timeoutinmultiplefiles.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
✔ a › a passes two
---tty-stream-chunk-separator

✖ Exited because no new tests completed within the last 1000ms of inactivity
✖ Exited because no new tests completed within the last 10000ms of inactivity

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

Expand All @@ -18,7 +18,7 @@
✔ b › b passes two
---tty-stream-chunk-separator

✖ Exited because no new tests completed within the last 1000ms of inactivity
✖ Exited because no new tests completed within the last 10000ms of inactivity

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

Expand Down
2 changes: 1 addition & 1 deletion test/reporters/verbose.timeoutinsinglefile.log
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
✔ passes two
---tty-stream-chunk-separator

✖ Exited because no new tests completed within the last 1000ms of inactivity
✖ Exited because no new tests completed within the last 10000ms of inactivity

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

Expand Down

0 comments on commit afe028a

Please sign in to comment.