diff --git a/.gitignore b/.gitignore index 257367d2e..de2026905 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,7 @@ vagrant .DS_Store .sass-cache -bin/*-v8-* \ No newline at end of file +bin/*-v8-* + +lib-coverage/ +sass-coverage.js diff --git a/.travis.yml b/.travis.yml index 4cee54024..84c450c13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ language: node_js node_js: - - 0.10 \ No newline at end of file + - "0.10" +after_success: + - npm run-script coverage diff --git a/README.md b/README.md index cdfe334bf..7abd4597c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![NPM version](https://badge.fury.io/js/node-sass.png)](http://badge.fury.io/js/node-sass) [![Dependency Status](https://david-dm.org/andrew/node-sass.png?theme=shields.io)](https://david-dm.org/andrew/node-sass) [![devDependency Status](https://david-dm.org/andrew/node-sass/dev-status.png?theme=shields.io)](https://david-dm.org/andrew/node-sass#info=devDependencies) +[![Coverage Status](https://coveralls.io/repos/andrew/node-sass/badge.png)](https://coveralls.io/r/andrew/node-sass) Node-sass is a library that provides binding for Node.js to [libsass](https://github.com/hcatlin/libsass), the C version of the popular stylesheet preprocessor, Sass. diff --git a/package.json b/package.json index 4e250c510..f4497d32b 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "scripts": { "install": "node build.js", "test": "mocha test", + "coverage": "bash scripts/coverage.sh", "pretest": "jshint .", "prepublish": "bash scripts/prepublish.sh" }, @@ -45,6 +46,9 @@ "nan": "~0.6.0" }, "devDependencies": { - "jshint": "~2.4.0" + "jshint": "~2.4.0", + "coveralls": "~2.6.1", + "mocha-lcov-reporter": "0.0.1", + "jscoverage": "~0.3.8" } } diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100644 index 000000000..47f469794 --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +./node_modules/.bin/jscoverage sass.js sass-coverage.js +./node_modules/.bin/jscoverage lib lib-coverage + +NODESASS_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js \ No newline at end of file diff --git a/test/cli.js b/test/cli.js index 98ed3305a..dd70fdeac 100644 --- a/test/cli.js +++ b/test/cli.js @@ -2,7 +2,7 @@ var path = require('path'), assert = require('assert'), fs = require('fs'), exec = require('child_process').exec, - cli = require('../lib/cli'), + cli = process.env.NODESASS_COVERAGE ? require('../lib-coverage/cli') : require('../lib/cli'), cliPath = path.resolve(__dirname, '../bin/node-sass'), sampleFilename = path.resolve(__dirname, 'sample.scss'); diff --git a/test/test.js b/test/test.js index 29cae8f23..f7b87471c 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ /*jshint multistr:true */ -var sass = require('../sass'); +var sass = process.env.NODESASS_COVERAGE ? require('../sass-coverage') : require('../sass'); var assert = require('assert'); var path = require('path'); var badSampleFilename = 'sample.scss';