Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Commit 561557a

Browse files
committed
Add coveralls badge and improve build script.
The introduction of the coveralls build somewhat unintentionally had all tests running at once. This used to fail which was the reason that the coverage.sh script was introduced so that the coverage would run separately for unit and integration tests and the results were combined. However it should really be possible to run all tests at once, so that it makes sense to do so in the build. This should allow to see regressions in this respect. The coverage script itself is kept as it can still be useful during development if only to see how one can run the commands in a shell without installing istanbul or mocha globally. Finally the travis script now sends coverage data in a second step to coveralls with the intent to easier distinguish cases where the tests fail and where coveralls fails.
1 parent 6edf18f commit 561557a

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

.travis.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@ install:
2929
- npm install
3030

3131
script:
32-
- NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
32+
- NODE_ENV=test npm run coverage
3333
- NODE_ENV=test npm run lint
34+
35+
after_script:
36+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![IRC](https://img.shields.io/badge/Slack-IRC-green.svg)](https://anvilresearch.slack.com/account/gateways)
55

66
[![Build Status](https://travis-ci.org/anvilresearch/connect.svg?branch=master)](https://travis-ci.org/anvilresearch/connect)
7+
[![Coverage Status](https://coveralls.io/repos/anvilresearch/connect/badge.svg?branch=master&service=github)](https://coveralls.io/github/anvilresearch/connect?branch=master)
78
![Dependencies](https://img.shields.io/david/anvilresearch/connect.svg) ![License](https://img.shields.io/github/license/anvilresearch/connect.svg) ![Downloads](https://img.shields.io/npm/dm/anvil-connect.svg)
89
![npm](https://img.shields.io/npm/v/anvil-connect.svg)
910

@@ -77,4 +78,3 @@ Support and consulting also available, contact us via [the website](http://anvil
7778
## MIT License
7879

7980
Copyright (c) 2015 [Anvil Research, Inc.](http://anvil.io)
80-

coverage.sh

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/bash
2+
# This script was used by package.json during `npm run coverage`
3+
#
4+
# Initially this was done to have our unit tests and integration
5+
# tests run seperately while still combining their coverage data.
6+
#
7+
# One reason to was that the tests were failing when run together.
8+
# Now something has changed and this is no longer the case.
9+
#
10+
# Since we want to be able to run all tests at once it makes
11+
# sense to do this during the build so regressions will fail the
12+
# build.
13+
#
14+
# This script remains useful during development.
215

316
set -e
417

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"test-integration": "mocha test/integration",
6969
"test-integration-watch": "mocha test/integration --watch",
7070
"test-all": "mocha test/unit && mocha test/integration",
71-
"coverage": "./coverage.sh"
71+
"coverage": "NODE_ENV=test istanbul cover _mocha -- test/"
7272
},
7373
"main": "server.js",
7474
"license": "MIT",

0 commit comments

Comments
 (0)