mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Support for generating code coverage reports
This commit is contained in:
parent
2508dd35f5
commit
e465c24f2b
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@
|
|||||||
node_modules
|
node_modules
|
||||||
build/
|
build/
|
||||||
sftp-config.json
|
sftp-config.json
|
||||||
|
coverage/
|
||||||
|
temp/
|
||||||
|
32
Gruntfile.js
32
Gruntfile.js
@ -1,3 +1,5 @@
|
|||||||
|
/* global module */
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
@ -5,7 +7,7 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks("grunt-contrib-concat");
|
grunt.loadNpmTasks("grunt-contrib-concat");
|
||||||
grunt.loadNpmTasks("grunt-contrib-jshint");
|
grunt.loadNpmTasks("grunt-contrib-jshint");
|
||||||
grunt.loadNpmTasks("grunt-contrib-uglify");
|
grunt.loadNpmTasks("grunt-contrib-uglify");
|
||||||
grunt.loadNpmTasks("grunt-contrib-qunit");
|
grunt.loadNpmTasks("grunt-qunit-istanbul");
|
||||||
grunt.loadNpmTasks("grunt-contrib-connect");
|
grunt.loadNpmTasks("grunt-contrib-connect");
|
||||||
grunt.loadNpmTasks("grunt-contrib-watch");
|
grunt.loadNpmTasks("grunt-contrib-watch");
|
||||||
grunt.loadNpmTasks("grunt-contrib-clean");
|
grunt.loadNpmTasks("grunt-contrib-clean");
|
||||||
@ -72,6 +74,7 @@ module.exports = function(grunt) {
|
|||||||
clean: {
|
clean: {
|
||||||
build: ["build"],
|
build: ["build"],
|
||||||
package: [packageDir],
|
package: [packageDir],
|
||||||
|
coverage: ["coverage"],
|
||||||
release: {
|
release: {
|
||||||
src: [releaseRoot],
|
src: [releaseRoot],
|
||||||
options: {
|
options: {
|
||||||
@ -137,10 +140,26 @@ module.exports = function(grunt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
qunit: {
|
qunit: {
|
||||||
|
normal: {
|
||||||
|
options: {
|
||||||
|
urls: [ "http://localhost:8000/test/test.html" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
coverage: {
|
||||||
|
options: {
|
||||||
|
urls: [ "http://localhost:8000/test/coverage.html" ],
|
||||||
|
coverage: {
|
||||||
|
src: ['src/*.js'],
|
||||||
|
htmlReport: 'coverage/html/',
|
||||||
|
instrumentedFiles: 'temp/',
|
||||||
|
baseUrl: '.',
|
||||||
|
disposeCollector: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
all: {
|
all: {
|
||||||
options: {
|
options: {
|
||||||
timeout: 10000,
|
timeout: 10000
|
||||||
urls: [ "http://localhost:8000/test/test.html" ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -248,7 +267,12 @@ module.exports = function(grunt) {
|
|||||||
// ----------
|
// ----------
|
||||||
// Test task.
|
// Test task.
|
||||||
// Builds and runs unit tests.
|
// Builds and runs unit tests.
|
||||||
grunt.registerTask("test", ["build", "connect", "qunit"]);
|
grunt.registerTask("test", ["build", "connect", "qunit:normal"]);
|
||||||
|
|
||||||
|
// ----------
|
||||||
|
// Coverage task.
|
||||||
|
// Outputs unit test code coverage report.
|
||||||
|
grunt.registerTask("coverage", ["clean:coverage", "connect", "qunit:coverage"]);
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
// Package task.
|
// Package task.
|
||||||
|
@ -63,6 +63,12 @@ and open `http://localhost:8000/test/test.html` in your browser.
|
|||||||
|
|
||||||
Another good page, if you want to interactively test out your changes, is `http://localhost:8000/test/demo/basic.html`.
|
Another good page, if you want to interactively test out your changes, is `http://localhost:8000/test/demo/basic.html`.
|
||||||
|
|
||||||
|
You can also get a report of the tests' code coverage:
|
||||||
|
|
||||||
|
grunt coverage
|
||||||
|
|
||||||
|
The report shows up at `coverage/html/index.html` viewable in a browser.
|
||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
|
|
||||||
OpenSeadragon is truly a community project; we welcome your involvement!
|
OpenSeadragon is truly a community project; we welcome your involvement!
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
"grunt-git-describe": "^2.3.2",
|
"grunt-git-describe": "^2.3.2",
|
||||||
"grunt-contrib-uglify": "^0.4.0",
|
"grunt-contrib-uglify": "^0.4.0",
|
||||||
"grunt-contrib-watch": "^0.6.1",
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"grunt-contrib-qunit": "^0.5.1",
|
|
||||||
"grunt-contrib-jshint": "^0.10.0",
|
"grunt-contrib-jshint": "^0.10.0",
|
||||||
"grunt-contrib-compress": "^0.9.1",
|
"grunt-contrib-compress": "^0.9.1",
|
||||||
"grunt-contrib-connect": "^0.7.1",
|
"grunt-contrib-connect": "^0.7.1",
|
||||||
"qunitjs": "^1.14.0"
|
"qunitjs": "^1.14.0",
|
||||||
|
"grunt-qunit-istanbul": "^0.4.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "grunt test"
|
"test": "grunt test"
|
||||||
|
76
test/coverage.html
Normal file
76
test/coverage.html
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>OpenSeadragon QUnit</title>
|
||||||
|
<link rel="stylesheet" href="/node_modules/qunitjs/qunit/qunit.css">
|
||||||
|
<link rel="stylesheet" href="/test/lib/jquery-ui-1.10.2/css/smoothness/jquery-ui-1.10.2.min.css">
|
||||||
|
<link rel="stylesheet" href="/test/test.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="qunit"></div>
|
||||||
|
<div id="qunit-fixture"></div>
|
||||||
|
<script src="/node_modules/qunitjs/qunit/qunit.js"></script>
|
||||||
|
<script src="/test/lib/jquery-1.9.1.min.js"></script>
|
||||||
|
<script src="/test/lib/jquery-ui-1.10.2/js/jquery-ui-1.10.2.min.js"></script>
|
||||||
|
<script src="/test/lib/jquery.simulate.js"></script>
|
||||||
|
|
||||||
|
<!-- OpenSeadragon sources -->
|
||||||
|
<script src="/src/openseadragon.js"></script>
|
||||||
|
<script src="/src/fullscreen.js"></script>
|
||||||
|
<script src="/src/eventsource.js"></script>
|
||||||
|
<script src="/src/mousetracker.js"></script>
|
||||||
|
<script src="/src/control.js"></script>
|
||||||
|
<script src="/src/controldock.js"></script>
|
||||||
|
<script src="/src/viewer.js"></script>
|
||||||
|
<script src="/src/navigator.js"></script>
|
||||||
|
<script src="/src/strings.js"></script>
|
||||||
|
<script src="/src/point.js"></script>
|
||||||
|
<script src="/src/tilesource.js"></script>
|
||||||
|
<script src="/src/dzitilesource.js"></script>
|
||||||
|
<script src="/src/iiiftilesource.js"></script>
|
||||||
|
<script src="/src/osmtilesource.js"></script>
|
||||||
|
<script src="/src/tmstilesource.js"></script>
|
||||||
|
<script src="/src/legacytilesource.js"></script>
|
||||||
|
<script src="/src/tilesourcecollection.js"></script>
|
||||||
|
<script src="/src/button.js"></script>
|
||||||
|
<script src="/src/buttongroup.js"></script>
|
||||||
|
<script src="/src/rectangle.js"></script>
|
||||||
|
<script src="/src/referencestrip.js"></script>
|
||||||
|
<script src="/src/displayrectangle.js"></script>
|
||||||
|
<script src="/src/spring.js"></script>
|
||||||
|
<script src="/src/imageLoader.js"></script>
|
||||||
|
<script src="/src/tile.js"></script>
|
||||||
|
<script src="/src/overlay.js"></script>
|
||||||
|
<script src="/src/drawer.js"></script>
|
||||||
|
<script src="/src/viewport.js"></script>
|
||||||
|
<script src="/src/tiledimage.js"></script>
|
||||||
|
<script src="/src/tilecache.js"></script>
|
||||||
|
<script src="/src/world.js"></script>
|
||||||
|
|
||||||
|
<!-- Helpers -->
|
||||||
|
<script src="/test/legacy.mouse.shim.js"></script>
|
||||||
|
<script src="/test/test.js"></script>
|
||||||
|
|
||||||
|
<!-- Modules -->
|
||||||
|
<!-- Polyfill must be inserted first because it is testing functions
|
||||||
|
reassignments which could be done by other test. -->
|
||||||
|
<script src="/test/polyfills.js"></script>
|
||||||
|
<script src="/test/basic.js"></script>
|
||||||
|
<script src="/test/strings.js"></script>
|
||||||
|
<script src="/test/formats.js"></script>
|
||||||
|
<script src="/test/utils.js"></script>
|
||||||
|
<script src="/test/events.js"></script>
|
||||||
|
<script src="/test/units.js"></script>
|
||||||
|
<script src="/test/multi-image.js"></script>
|
||||||
|
<script src="/test/overlays.js"></script>
|
||||||
|
<script src="/test/controls.js"></script>
|
||||||
|
<script src="/test/viewport.js"></script>
|
||||||
|
<script src="/test/modules/world.js"></script>
|
||||||
|
<script src="/test/modules/drawer.js"></script>
|
||||||
|
<script src="/test/modules/tiledimage.js"></script>
|
||||||
|
<!-- The navigator tests are the slowest (for now; hopefully they can be sped up)
|
||||||
|
so we put them last. -->
|
||||||
|
<script src="/test/navigator.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,7 +1,5 @@
|
|||||||
/* global QUnit, module, Util, $, console, test, asyncTest, start, ok, equal */
|
/* global QUnit, module, Util, $, console, test, asyncTest, start, ok, equal */
|
||||||
|
|
||||||
QUnit.config.autostart = false;
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var debug = false,
|
var debug = false,
|
||||||
viewer,
|
viewer,
|
||||||
@ -31,10 +29,6 @@ QUnit.config.autostart = false;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
start();
|
|
||||||
});
|
|
||||||
|
|
||||||
var resetTestVariables = function () {
|
var resetTestVariables = function () {
|
||||||
if (viewer) {
|
if (viewer) {
|
||||||
viewer.close();
|
viewer.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user