From 2da36a2851149f609ab189eed3454408c94df536 Mon Sep 17 00:00:00 2001 From: Eldar Djafarov Date: Sat, 2 Feb 2013 05:29:20 -0200 Subject: [PATCH 1/3] test coverage initial commit --- .gitignore | 1 + build/build.js | 16 +++++++++++++++- package.json | 2 +- spec/testacular.conf.js | 38 ++++++++++---------------------------- 4 files changed, 27 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index b86ab6fc..b9b8db0e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/**/* *.sublime-* _site dist/*.js +coverage/ diff --git a/build/build.js b/build/build.js index d455d467..6eda294d 100644 --- a/build/build.js +++ b/build/build.js @@ -156,12 +156,26 @@ exports.build = function (compsBase32, buildName) { }; exports.test = function() { - var testacular = require('testacular'), + var testacular = require('../node_modules/testacular/lib/index.js'), testConfig = {configFile : __dirname + '/../spec/testacular.conf.js'}; testConfig.browsers = ['PhantomJS']; isArgv('--chrome') && testConfig.browsers.push('Chrome'); isArgv('--ff') && testConfig.browsers.push('Firefox'); + + //will work only with new testacular that supports codecoverage + //today its in master + if(isArgv('--cov')){ + testConfig.preprocessors = { + '**/src/**/*.js': 'coverage', + }; + testConfig.coverageReporter = { + type : 'html', + dir : 'coverage/' + }; + testConfig.reporters = ['coverage']; + } + testacular.server.start(testConfig); diff --git a/package.json b/package.json index 4ba8ca70..78581f60 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "Jakefile.js", "dependencies": { "jshint": "~0.9.1", - "testacular": "~0.4.0", + "testacular": "latest", "uglify-js": "~2.2.3", "jake": "latest" }, diff --git a/spec/testacular.conf.js b/spec/testacular.conf.js index 9137f4d9..54a57420 100644 --- a/spec/testacular.conf.js +++ b/spec/testacular.conf.js @@ -1,5 +1,4 @@ // Testacular configuration - var libSources = require(__dirname+'/../build/build.js').getFiles(); // base path, that will be used to resolve files and exclude @@ -11,32 +10,14 @@ for (var i=0; i < libSources.length; i++) { // list of files / patterns to load in the browser files = [].concat([ - JASMINE, - JASMINE_ADAPTER, - "before.js" - ], libSources, [ - "after.js", - "happen.js", - "suites/SpecHelper.js", - "suites/LeafletSpec.js", - "suites/control/Control.LayersSpec.js", - "suites/control/Control.ScaleSpec.js", - "suites/core/UtilSpec.js", - "suites/core/ClassSpec.js", - "suites/core/EventsSpec.js", - "suites/geometry/PointSpec.js", - "suites/geometry/BoundsSpec.js", - "suites/geometry/TransformationSpec.js", - "suites/geo/LatLngSpec.js", - "suites/geo/LatLngBoundsSpec.js", - "suites/geo/ProjectionSpec.js", - "suites/dom/DomEventSpec.js", - "suites/dom/DomUtilSpec.js", - "suites/layer/TileLayerSpec.js", - "suites/layer/vector/PolylineGeometrySpec.js", - "suites/layer/vector/CircleSpec.js", - "suites/map/MapSpec.js" - ]); + JASMINE, + JASMINE_ADAPTER, + "before.js" + ], libSources, [ + "after.js", + "happen.js", + "suites/**/*.js" + ]); // list of files to exclude exclude = [ @@ -46,7 +27,7 @@ exclude = [ // possible values: 'dots', 'progress', 'junit' reporters = ['dots']; -// web server port +//aa web server port port = 8080; // cli runner port @@ -78,3 +59,4 @@ captureTimeout = 5000; // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun = true; + From 071bb587b817520c50939745a3bcdf921040897b Mon Sep 17 00:00:00 2001 From: Eldar Djafarov Date: Sat, 2 Feb 2013 05:48:14 -0200 Subject: [PATCH 2/3] use master testacular only if --cov --- build/build.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/build.js b/build/build.js index 6eda294d..46f3afa0 100644 --- a/build/build.js +++ b/build/build.js @@ -156,7 +156,7 @@ exports.build = function (compsBase32, buildName) { }; exports.test = function() { - var testacular = require('../node_modules/testacular/lib/index.js'), + var testacular = require('testacular'), testConfig = {configFile : __dirname + '/../spec/testacular.conf.js'}; testConfig.browsers = ['PhantomJS']; @@ -165,7 +165,8 @@ exports.test = function() { //will work only with new testacular that supports codecoverage //today its in master - if(isArgv('--cov')){ + if(isArgv('--cov')){ // temporary hack untill testacular with coverage become stable + testacular = require('../node_modules/testacular/lib/index.js'); //use local testacular testConfig.preprocessors = { '**/src/**/*.js': 'coverage', }; From e4492b6f106af5c3bdd12d956ee6b550c0a40bf6 Mon Sep 17 00:00:00 2001 From: Eldar Djafarov Date: Sat, 2 Feb 2013 10:59:30 -0200 Subject: [PATCH 3/3] Fix: SpecHelper should be first --- spec/testacular.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/testacular.conf.js b/spec/testacular.conf.js index 54a57420..ce08ff6d 100644 --- a/spec/testacular.conf.js +++ b/spec/testacular.conf.js @@ -16,6 +16,7 @@ files = [].concat([ ], libSources, [ "after.js", "happen.js", + "suites/SpecHelper.js", "suites/**/*.js" ]);