diff --git a/.gitignore b/.gitignore index 225b7875..ed5d11aa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ # common +coverage node_modules *.log -.tmp +.nyc_output .tests +.tmp # build-artifacts dist diff --git a/.npmignore b/.npmignore index 96afab14..e428f04f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,8 +1,10 @@ # common +coverage node_modules *.log -.tmp +.nyc_output .tests +.tmp # source/config src diff --git a/.travis.yml b/.travis.yml index cf29732c..6534e8b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,15 @@ -language: node_js -node_js: -- iojs-v2 -- iojs-v1 -- '0.10' -- '0.12' sudo: false +language: node_js cache: directories: - node_modules notifications: email: false +node_js: +- iojs-v2 +- iojs-v1 +- '0.12' +- '0.10' before_install: - npm i -g npm@^2.0.0 before_script: @@ -18,6 +18,7 @@ before_script: after_success: - python travis_after_all.py - export $(cat .to_export_back) +- if [[ $BUILD_LEADER = YES ]]; then npm run coveralls; fi after_failure: - python travis_after_all.py - export $(cat .to_export_back) diff --git a/README.md b/README.md index c5fcfc09..165f95db 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # semantic-release [![Build Status](https://travis-ci.org/boennemann/semantic-release.svg?branch=master)](https://travis-ci.org/boennemann/semantic-release) +[![Coverage Status](https://coveralls.io/repos/boennemann/semantic-release/badge.svg)](https://coveralls.io/r/boennemann/semantic-release) [![Dependency Status](https://david-dm.org/boennemann/semantic-release.svg)](https://david-dm.org/boennemann/semantic-release) [![devDependency Status](https://david-dm.org/boennemann/semantic-release/dev-status.svg)](https://david-dm.org/boennemann/semantic-release#info=devDependencies) diff --git a/bin/semantic-release.js b/bin/semantic-release.js index 2f1ccba6..d60dab52 100755 --- a/bin/semantic-release.js +++ b/bin/semantic-release.js @@ -27,6 +27,7 @@ var plugins = JSON.parse(readFile('./package.json')).release || {} var main +/* istanbul ignore next */ try { main = require('../dist/main') } catch (e) { diff --git a/package.json b/package.json index 1dcb3402..50eff27a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,14 @@ "bugs": { "url": "https://github.com/boennemann/semantic-release/issues" }, + "config": { + "nyc": { + "exclude": [ + ".tests", + "node_modules" + ] + } + }, "dependencies": { "abbrev": "^1.0.5", "async": "^1.0.0", @@ -23,12 +31,14 @@ "semver": "^4.3.3" }, "devDependencies": { + "coveralls": "^2.11.2", "cracks": "^2.0.1", "github-release-fake-server": "^1.3.0", "lodash.defaults": "^3.0.0", "nano-uid": "^0.2.0", "nixt": "^0.4.1", "nock": "^2.2.0", + "nyc": "^2.3.0", "sinopia": "^1.0.0", "standard": "^4.0.1", "tap": "^1.2.0" @@ -64,12 +74,14 @@ }, "scripts": { "build": "rm -rf dist && mkdir -p dist && babel src --out-dir dist", + "build:tests": "rm -rf .tests && mkdir -p .tests && babel tests --out-dir .tests", + "coverage": "nyc report", + "coveralls": "npm run coverage -- --reporter=lcovonly && cat coverage/lcov.info | coveralls", "postpublish": "./bin/semantic-release.js post", "prepublish": "npm run build && ./bin/semantic-release.js pre", - "pretest": "npm run build", - "pretest:integration": "rm -rf .tests && mkdir -p .tests && babel tests --out-dir .tests", + "pretest:integration": "npm run build && npm run build:tests", "test": "./bin/test", - "test:integration": "tap .tests/{scenarios,tap}/*.js", + "test:integration": "nyc tap --no-cov .tests/{scenarios,tap}/*.js", "test:style": "standard" } }