From 433cde644c1e22b9b6639918d90f50c11b13a1b5 Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Tue, 28 Apr 2015 07:39:06 +0000 Subject: [PATCH] Measure coverage for all js tests Instrument spec.js for test coverage measurement. Instrument all .js files in the test directory. --- .jshintignore | 1 + scripts/coverage.js | 2 +- test/spec.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.jshintignore b/.jshintignore index a8603104a..4f3868519 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1 +1,2 @@ node_modules/** +test/coverage/html diff --git a/scripts/coverage.js b/scripts/coverage.js index d0f406324..ce6a7968a 100644 --- a/scripts/coverage.js +++ b/scripts/coverage.js @@ -56,7 +56,7 @@ function coverage() { instrumentedfiles.push(source); if (instrumentedfiles.length === sourcefiles.length) { fs.readdirSync('test').filter(function(file){ - return file.substr(-6) === 'api.js'; + return file.substr(-3) === '.js'; }).forEach(function(file){ mocha.addFile( path.join('test', file) diff --git a/test/spec.js b/test/spec.js index 1f2d26ff1..175fb6ad2 100644 --- a/test/spec.js +++ b/test/spec.js @@ -3,7 +3,9 @@ var assert = require('assert'), exists = fs.existsSync, path = require('path'), read = fs.readFileSync, - sass = require('../lib'), + sass = process.env.NODESASS_COV + ? require('../lib-cov') + : require('../lib'), util = require('./util'); describe('spec', function() {