(#7554) - Add convenience function to run coverage
diff --git a/.travis.yml b/.travis.yml
index 042fc6a..8bdf84a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -98,9 +98,7 @@
- COMMAND=test-unit
- COMMAND=test-component
- COMMAND=test-fuzzy
- # need extra env variable COVERAGE here because of some subtlety in Travis containers not
- # passing the process.env.COVERAGE to the node process
- - COMMAND=report-coverage COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find
+ - SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find COVERAGE=1 COMMAND=report-coverage
- COMMAND=verify-build
matrix:
diff --git a/bin/run-test.sh b/bin/run-test.sh
index 5261a7a..07f508b 100755
--- a/bin/run-test.sh
+++ b/bin/run-test.sh
@@ -6,7 +6,7 @@
if [[ ! -z $SERVER ]]; then
if [ "$SERVER" == "pouchdb-server" ]; then
export COUCH_HOST='http://127.0.0.1:6984'
- if [[ "$TRAVIS_REPO_SLUG" == "pouchdb/pouchdb" ]]; then
+ if [[ "$TRAVIS_REPO_SLUG" == "pouchdb/pouchdb" || "$COVERAGE" == 1 ]]; then
# in travis, link pouchdb-servers dependencies on pouchdb
# modules to the current implementations
mkdir pouchdb-server-install
diff --git a/package.json b/package.json
index a57c6ea..9b53bbe 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,6 @@
"test-component": "mocha tests/component",
"test-fuzzy": "TYPE=fuzzy npm run test",
"test-browser": "npm run build-test && node ./bin/test-browser.js",
- "test-coverage": "bash bin/test-coverage.sh",
"test-memleak": "mocha -gc tests/memleak",
"eslint": "eslint bin/ packages/node_modules/**/src tests/",
"dev": "bash bin/run-dev.sh",
@@ -25,6 +24,8 @@
"install-jekyll": "sh bin/install-jekyll.sh",
"publish-site": "sh bin/publish-site.sh",
"build-site": "node ./bin/build-site.js",
+ "test-coverage": "bash bin/test-coverage.sh",
+ "coverage": "COVERAGE=1 SERVER=pouchdb-server POUCHDB_SERVER_FLAGS=--in-memory PLUGINS=pouchdb-find bash bin/test-coverage.sh",
"report-coverage": "npm run test-coverage && istanbul-coveralls --no-rm",
"build-test": "npm run build-test-utils && npm run build-perf",
"build-test-utils": "browserify tests/integration/utils.js > tests/integration/utils-bundle.js",