Merge pull request #1326 from edjafarov/master
add testacular runner for jasmine tests
This commit is contained in:
commit
a63c90159b
@ -20,4 +20,7 @@ task('lint', build.lint);
|
|||||||
desc('Combine and compress Leaflet source files');
|
desc('Combine and compress Leaflet source files');
|
||||||
task('build', ['lint'], build.build);
|
task('build', ['lint'], build.build);
|
||||||
|
|
||||||
|
desc('run phantomjs tests');
|
||||||
|
task('test', ['lint'], build.test);
|
||||||
|
|
||||||
task('default', ['build']);
|
task('default', ['build']);
|
||||||
|
@ -3,8 +3,8 @@ var fs = require('fs'),
|
|||||||
UglifyJS = require('uglify-js'),
|
UglifyJS = require('uglify-js'),
|
||||||
|
|
||||||
deps = require('./deps.js').deps,
|
deps = require('./deps.js').deps,
|
||||||
hintrc = require('./hintrc.js').config;
|
hintrc = require('./hintrc.js').config,
|
||||||
|
testacular = require('testacular');
|
||||||
|
|
||||||
function lintFiles(files) {
|
function lintFiles(files) {
|
||||||
|
|
||||||
@ -64,6 +64,8 @@ function getFiles(compsBase32) {
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.getFiles = getFiles;
|
||||||
|
|
||||||
exports.lint = function () {
|
exports.lint = function () {
|
||||||
|
|
||||||
var files = getFiles();
|
var files = getFiles();
|
||||||
@ -153,3 +155,18 @@ exports.build = function (compsBase32, buildName) {
|
|||||||
console.log('\tSaved to ' + path);
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,102 +1,27 @@
|
|||||||
(function() {
|
(function() {
|
||||||
//TODO replace script list with the one from ../buid/deps.js
|
//TODO replace script list with the one from ../buid/deps.js
|
||||||
var scripts = [
|
function getFiles() {
|
||||||
'Leaflet.js',
|
var memo = {},
|
||||||
|
comps;
|
||||||
|
|
||||||
'core/Util.js',
|
function addFiles(srcs) {
|
||||||
'core/Class.js',
|
for (var j = 0, len = srcs.length; j < len; j++) {
|
||||||
'core/Events.js',
|
memo[srcs[j]] = true;
|
||||||
'core/Browser.js',
|
}
|
||||||
|
}
|
||||||
|
|
||||||
'geometry/Point.js',
|
for (var i in deps) {
|
||||||
'geometry/Bounds.js',
|
addFiles(deps[i].src);
|
||||||
'geometry/Transformation.js',
|
}
|
||||||
'geometry/LineUtil.js',
|
var files = [];
|
||||||
'geometry/PolyUtil.js',
|
|
||||||
|
|
||||||
'dom/DomEvent.js',
|
for (var src in memo) {
|
||||||
'dom/DomEvent.DoubleTap.js',
|
files.push('src/' + src);
|
||||||
'dom/DomEvent.MsTouch.js',
|
}
|
||||||
'dom/DomUtil.js',
|
|
||||||
'dom/Draggable.js',
|
|
||||||
|
|
||||||
'dom/PosAnimation.js',
|
return files;
|
||||||
'dom/PosAnimation.Timer.js',
|
}
|
||||||
// 'dom/transition/Transition.js',
|
var scripts = getFiles();
|
||||||
// 'dom/transition/Transition.Native.js',
|
|
||||||
// 'dom/transition/Transition.Timer.js',
|
|
||||||
|
|
||||||
'geo/LatLng.js',
|
|
||||||
'geo/LatLngBounds.js',
|
|
||||||
|
|
||||||
'geo/projection/Projection.js',
|
|
||||||
'geo/projection/Projection.SphericalMercator.js',
|
|
||||||
'geo/projection/Projection.LonLat.js',
|
|
||||||
'geo/projection/Projection.Mercator.js',
|
|
||||||
|
|
||||||
'geo/crs/CRS.js',
|
|
||||||
'geo/crs/CRS.EPSG3857.js',
|
|
||||||
'geo/crs/CRS.EPSG4326.js',
|
|
||||||
'geo/crs/CRS.EPSG3395.js',
|
|
||||||
'geo/crs/CRS.Simple.js',
|
|
||||||
|
|
||||||
'map/Map.js',
|
|
||||||
|
|
||||||
'map/ext/Map.Geolocation.js',
|
|
||||||
'map/ext/Map.Popup.js',
|
|
||||||
'map/ext/Map.Control.js',
|
|
||||||
|
|
||||||
'map/anim/Map.PanAnimation.js',
|
|
||||||
'map/anim/Map.ZoomAnimation.js',
|
|
||||||
|
|
||||||
'core/Handler.js',
|
|
||||||
'map/handler/Map.Drag.js',
|
|
||||||
'map/handler/Map.TouchZoom.js',
|
|
||||||
'map/handler/Map.DoubleClickZoom.js',
|
|
||||||
'map/handler/Map.ScrollWheelZoom.js',
|
|
||||||
'map/handler/Map.BoxZoom.js',
|
|
||||||
'map/handler/Map.Keyboard.js',
|
|
||||||
|
|
||||||
'layer/LayerGroup.js',
|
|
||||||
'layer/FeatureGroup.js',
|
|
||||||
|
|
||||||
'layer/tile/TileLayer.js',
|
|
||||||
'layer/tile/TileLayer.WMS.js',
|
|
||||||
'layer/tile/TileLayer.Canvas.js',
|
|
||||||
'layer/ImageOverlay.js',
|
|
||||||
'layer/Popup.js',
|
|
||||||
|
|
||||||
'layer/marker/Icon.js',
|
|
||||||
'layer/marker/Icon.Default.js',
|
|
||||||
'layer/marker/DivIcon.js',
|
|
||||||
'layer/marker/Marker.js',
|
|
||||||
'layer/marker/Marker.Popup.js',
|
|
||||||
'layer/marker/Marker.Drag.js',
|
|
||||||
|
|
||||||
'layer/vector/Path.js',
|
|
||||||
'layer/vector/Path.Popup.js',
|
|
||||||
'layer/vector/Path.SVG.js',
|
|
||||||
'layer/vector/Path.VML.js',
|
|
||||||
'layer/vector/canvas/Path.Canvas.js',
|
|
||||||
'layer/vector/Polyline.js',
|
|
||||||
'layer/vector/Polyline.Edit.js',
|
|
||||||
'layer/vector/canvas/Polyline.Canvas.js',
|
|
||||||
'layer/vector/Polygon.js',
|
|
||||||
'layer/vector/Rectangle.js',
|
|
||||||
'layer/vector/canvas/Polygon.Canvas.js',
|
|
||||||
'layer/vector/MultiPoly.js',
|
|
||||||
'layer/vector/Circle.js',
|
|
||||||
'layer/vector/canvas/Circle.Canvas.js',
|
|
||||||
'layer/vector/CircleMarker.js',
|
|
||||||
|
|
||||||
'layer/GeoJSON.js',
|
|
||||||
|
|
||||||
'control/Control.js',
|
|
||||||
'control/Control.Zoom.js',
|
|
||||||
'control/Control.Attribution.js',
|
|
||||||
'control/Control.Layers.js',
|
|
||||||
'control/Control.Scale.js'
|
|
||||||
];
|
|
||||||
|
|
||||||
function getSrcUrl() {
|
function getSrcUrl() {
|
||||||
var scripts = document.getElementsByTagName('script');
|
var scripts = document.getElementsByTagName('script');
|
||||||
@ -105,7 +30,7 @@
|
|||||||
if (src) {
|
if (src) {
|
||||||
var res = src.match(/^(.*)leaflet-include\.js$/);
|
var res = src.match(/^(.*)leaflet-include\.js$/);
|
||||||
if (res) {
|
if (res) {
|
||||||
return res[1] + '../src/';
|
return res[1] + '../';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
spec/beforeTestsContext.js
Normal file
1
spec/beforeTestsContext.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
L.Icon.Default.imagePath = "http://leafletjs.com/dist/images/marker-icon@2x.png";
|
3
spec/context.js
Normal file
3
spec/context.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
// set up context before tests
|
||||||
|
L = 'test'; //to test L#noConflict later
|
||||||
|
|
@ -8,10 +8,8 @@
|
|||||||
<script type="text/javascript" src="happen.js"></script>
|
<script type="text/javascript" src="happen.js"></script>
|
||||||
|
|
||||||
<!-- source files -->
|
<!-- source files -->
|
||||||
|
<script type="text/javascript" src="context.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript" src="../build/deps.js"></script>
|
||||||
L = 'test'; //to test L#noConflict later
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="../debug/leaflet-include.js"></script>
|
<script type="text/javascript" src="../debug/leaflet-include.js"></script>
|
||||||
|
|
||||||
|
90
spec/testacular.conf.js
Normal file
90
spec/testacular.conf.js
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
// Testacular configuration
|
||||||
|
// Generated on Sat Jan 19 2013 16:24:31 GMT-0200 (BRST)
|
||||||
|
var libSources = require(__dirname+'/../build/build.js').getFiles();
|
||||||
|
|
||||||
|
// base path, that will be used to resolve files and exclude
|
||||||
|
basePath = '';
|
||||||
|
|
||||||
|
for (var i=0; i < libSources.length; i++) {
|
||||||
|
libSources[i] = "../" + libSources[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// list of files / patterns to load in the browser
|
||||||
|
files = [].concat([
|
||||||
|
JASMINE,
|
||||||
|
JASMINE_ADAPTER,
|
||||||
|
"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"
|
||||||
|
]);
|
||||||
|
|
||||||
|
// list of files to exclude
|
||||||
|
exclude = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// test results reporter to use
|
||||||
|
// possible values: 'dots', 'progress', 'junit'
|
||||||
|
reporters = ['dots'];
|
||||||
|
|
||||||
|
|
||||||
|
// web server port
|
||||||
|
port = 8080;
|
||||||
|
|
||||||
|
|
||||||
|
// cli runner port
|
||||||
|
runnerPort = 9100;
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable colors in the output (reporters and logs)
|
||||||
|
colors = true;
|
||||||
|
|
||||||
|
|
||||||
|
// level of logging
|
||||||
|
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
|
||||||
|
logLevel = LOG_INFO;
|
||||||
|
|
||||||
|
|
||||||
|
// enable / disable watching file and executing tests whenever any file changes
|
||||||
|
autoWatch = false;
|
||||||
|
|
||||||
|
|
||||||
|
// Start these browsers, currently available:
|
||||||
|
// - Chrome
|
||||||
|
// - ChromeCanary
|
||||||
|
// - Firefox
|
||||||
|
// - Opera
|
||||||
|
// - Safari (only Mac)
|
||||||
|
// - PhantomJS
|
||||||
|
// - IE (only Windows)
|
||||||
|
browsers = ['PhantomJS'];
|
||||||
|
|
||||||
|
|
||||||
|
// If browser does not capture in given timeout [ms], kill it
|
||||||
|
captureTimeout = 5000;
|
||||||
|
|
||||||
|
|
||||||
|
// Continuous Integration mode
|
||||||
|
// if true, it capture browsers, run tests and exit
|
||||||
|
singleRun = true;
|
Loading…
Reference in New Issue
Block a user