enable testacular runner

This commit is contained in:
Eldar Djafarov 2013-01-30 12:06:19 -02:00
parent 88ba9dd0c8
commit 7e537eb954
5 changed files with 51 additions and 35 deletions

View File

@ -20,4 +20,7 @@ task('lint', build.lint);
desc('Combine and compress Leaflet source files');
task('build', ['lint'], build.build);
desc('run phantomjs tests');
task('test', ['lint'], build.test);
task('default', ['build']);

View File

@ -3,8 +3,8 @@ var fs = require('fs'),
UglifyJS = require('uglify-js'),
deps = require('./deps.js').deps,
hintrc = require('./hintrc.js').config;
hintrc = require('./hintrc.js').config,
testacular = require('testacular');
function lintFiles(files) {
@ -153,3 +153,18 @@ exports.build = function (compsBase32, buildName) {
console.log('\tSaved to ' + path);
}
};
exports.test = function(){
var testConfig ={
configFile : __dirname + '/../spec/testacular.conf.js'
}
testConfig.browsers = ['PhantomJS'];
isArgv('--chrome') && testConfig.browsers.push('Chrome');
isArgv('--ff') && testConfig.browsers.push('Firefox');
testacular.server.start(testConfig);
function isArgv(optName){
return process.argv.indexOf(optName) !== -1;
}
}

View File

@ -0,0 +1 @@
L.Icon.Default.imagePath = "http://leafletjs.com/dist/images/marker-icon@2x.png";

3
spec/context.js Normal file
View File

@ -0,0 +1,3 @@
// set up context before tests
L = 'test'; //to test L#noConflict later

View File

@ -4,10 +4,12 @@ var deps = require(__dirname+'/../build/deps.js').deps;
// base path, that will be used to resolve files and exclude
basePath = '';
var libSources = [];
for(var dep in deps){
libSources = libSources.concat(deps[dep].src);
}
for(var i=0;i<libSources.length;i++){
libSources[i]="../src/" + libSources[i];
}
@ -16,39 +18,31 @@ for(var i=0;i<libSources.length;i++){
files = [].concat([
JASMINE,
JASMINE_ADAPTER,
"happen.js"],
libSources,
["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"
"happen.js",
"context.js"],
libSources,
["beforeTestsContext.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"
]);
preprocessors = {
'**/src/*.js': 'coverage',
'**/src/**/*.js': 'coverage'
};
coverageReporter = {
type : 'html',
dir : 'coverage/'
}
// list of files to exclude
exclude = [
@ -57,7 +51,7 @@ exclude = [
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters = ['coverage'];
reporters = ['dots'];
// web server port
@ -74,7 +68,7 @@ colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel = LOG_DEBUG;
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes