Update phantomjs and use mocha-phantomjs-core

This commit is contained in:
Tim Schaub
2015-11-01 01:45:47 -06:00
parent 7946298e67
commit 98c9b0eb39
4 changed files with 20 additions and 26 deletions

View File

@@ -60,9 +60,9 @@
"jquery": "2.1.1", "jquery": "2.1.1",
"jshint": "2.8.0", "jshint": "2.8.0",
"mocha": "1.21.5", "mocha": "1.21.5",
"mocha-phantomjs": "3.5.1", "mocha-phantomjs-core": "^1.2.1",
"mustache": "2.1.3", "mustache": "2.1.3",
"phantomjs": "1.9.10", "phantomjs": "1.9.18",
"proj4": "2.3.12", "proj4": "2.3.12",
"resemblejs": "1.2.0", "resemblejs": "1.2.0",
"sinon": "1.10.3", "sinon": "1.10.3",

View File

@@ -58,10 +58,7 @@ function runTests(includeCoverage, callback) {
var address = server.address(); var address = server.address();
var url = 'http://' + address.address + ':' + address.port; var url = 'http://' + address.address + ':' + address.port;
var args = [ var args = [
path.join( require.resolve('mocha-phantomjs-core'),
__dirname,
'../node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee'
),
url + '/test/index.html' url + '/test/index.html'
]; ];
@@ -88,5 +85,3 @@ module.exports = {
runTests: runTests, runTests: runTests,
listen: listen listen: listen
}; };

View File

@@ -16,6 +16,9 @@
<script type="text/javascript" src="../node_modules/proj4/dist/proj4.js"></script> <script type="text/javascript" src="../node_modules/proj4/dist/proj4.js"></script>
<script type="text/javascript" src="test-extensions.js"></script> <script type="text/javascript" src="test-extensions.js"></script>
<script> <script>
if (typeof initMochaPhantomJS === 'function') {
initMochaPhantomJS()
}
mocha.setup({ mocha.setup({
ui: 'bdd', ui: 'bdd',
bail: false bail: false
@@ -43,25 +46,21 @@
*/ */
goog.events.listen(this, 'test', function() {}); goog.events.listen(this, 'test', function() {});
if (window.mochaPhantomJS) { var runner = mocha.run();
mochaPhantomJS.run(); if (window.console && console.log) {
} else { // write stacks to the console for failed tests
var runner = mocha.run(); runner.on('fail', function(test, err) {
if (window.console && console.log) { if (test.duration > test._timeout) {
// write stacks to the console for failed tests var titles = [];
runner.on('fail', function(test, err) { for (var p = test; p; p = p.parent) {
if (test.duration > test._timeout) { if (p.title) {
var titles = []; titles.unshift(p.title);
for (var p = test; p; p = p.parent) {
if (p.title) {
titles.unshift(p.title);
}
} }
console.log('Test timed out:', titles.join(' > '));
} }
console.error(test.err.stack); console.log('Test timed out:', titles.join(' > '));
}); }
} console.error(test.err.stack);
});
} }
</script> </script>
<!-- <!--

View File

@@ -10,7 +10,7 @@ var blue = 'data:image/gif;base64,R0lGODlhAQABAPAAAAAA/////yH5BAAAAAAALAAAAA' +
'ABAAEAAAICRAEAOw=='; 'ABAAEAAAICRAEAOw==';
function itNoPhantom() { function itNoPhantom() {
if (window.mochaPhantomJS) { if (window.initMochaPhantomJS) {
return xit.apply(this, arguments); return xit.apply(this, arguments);
} else { } else {
return it.apply(this, arguments); return it.apply(this, arguments);