Commit 8ac7c037 by Andrew Nesbitt

Merge pull request #503 from kevva/coverage

Move coverage script to Makefile
parents a19ed3dc 17e11ae6
...@@ -10,3 +10,6 @@ trim_trailing_whitespace = true ...@@ -10,3 +10,6 @@ trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[Makefile]
indent_style = tab
lib-cov
*.seed
*.log *.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules
npm-debug.log
build
vagrant
.lock-wscript
.DS_Store .DS_Store
.sass-cache .sass-cache
bin
bin/*-v8-* !bin/node-sass
build
lib-coverage/ lib-cov
sass-coverage.js node_modules
**/fixtures/**/build.*
BIN = ./node_modules/.bin
REPORTER = spec
clean:
@rm -rf lib-cov test/fixtures/*/build.css
lint:
@$(BIN)/jshint bin lib test
node_modules: package.json
@npm install
@touch node_modules
test: clean lint node_modules
@$(BIN)/_mocha \
--reporter $(REPORTER)
test-cov: clean lint node_modules
@$(BIN)/jscoverage lib lib-cov
@NODESASS_COV=1 $(BIN)/_mocha \
--reporter mocha-lcov-reporter | $(BIN)/coveralls
.PHONY: test clean
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}, },
"gypfile": true, "gypfile": true,
"scripts": { "scripts": {
"coverage": "node scripts/coverage", "coverage": "make test-cov",
"install": "node lib/build.js", "install": "node lib/build.js",
"prepublish": "node scripts/prepublish", "prepublish": "node scripts/prepublish",
"pretest": "node_modules/.bin/jshint bin lib test", "pretest": "node_modules/.bin/jshint bin lib test",
......
#!/usr/bin/env node
/*jshint shelljs:true */
"use strict";
require("shelljs/make");
var path = require("path");
var JSCOVERAGE_BIN = ["node_modules", ".bin", "jscoverage"].join(path.sep);
var COVERALLS_BIN = ["node_modules", ".bin", "coveralls"].join(path.sep);
var MOCHA_BIN = ["node_modules", ".bin", "mocha"].join(path.sep);
echo("Creating coverage files");
exec(JSCOVERAGE_BIN + " lib lib-coverage");
echo("Piping mocha to coveralls");
env["NODESASS_COVERAGE"] = 1;
exec(MOCHA_BIN + " test -R mocha-lcov-reporter | " + COVERALLS_BIN, {async: false}, function(code, output) {
console.log('Exit code:', code);
console.log('Program output:', output);
echo("Cleanup coverage files");
rm("-R", "lib-coverage");
});
...@@ -2,7 +2,7 @@ var assert = require('assert'), ...@@ -2,7 +2,7 @@ var assert = require('assert'),
fs = require('fs'), fs = require('fs'),
path = require('path'), path = require('path'),
read = fs.readFileSync, read = fs.readFileSync,
sass = require('../lib'), sass = process.env.NODESASS_COV ? require('../lib-cov') : require('../lib'),
fixture = path.join.bind(null, __dirname, 'fixtures'), fixture = path.join.bind(null, __dirname, 'fixtures'),
resolveFixture = path.resolve.bind(null, __dirname, 'fixtures'); resolveFixture = path.resolve.bind(null, __dirname, 'fixtures');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment