diff --git a/src/__tests__/casperjs/casperUtils.js b/src/__tests__/casperjs/casperUtils.js index 2dba0283..49cc81d2 100644 --- a/src/__tests__/casperjs/casperUtils.js +++ b/src/__tests__/casperjs/casperUtils.js @@ -4,6 +4,15 @@ var screenshotRoot = './src/__tests__/casperjs/screenshots/entirePage'; var CasperUtils = { + start: function(casper, url, callback) { + // Setup some sanity error handling + casper.on('page.error', function(msg, trace) { + casper.echo('Error: ' + msg, 'ERROR'); + casper.echo('Stack: ' + trace); + }); + casper.start(url, callback); + }, + getRoot: function() { // Unfortunately this is hardcoded for now :*( cant get the path // variable synchronously when running this test, and CasperJS does diff --git a/src/__tests__/casperjs/command_view_test.js b/src/__tests__/casperjs/command_view_test.js index 7121f6f6..c44679b7 100644 --- a/src/__tests__/casperjs/command_view_test.js +++ b/src/__tests__/casperjs/command_view_test.js @@ -1,7 +1,15 @@ var CasperUtils = require('./casperUtils').CasperUtils; +casper.on('page.error', function(msg, trace) { + casper.echo('Error: ' + msg, 'ERROR'); + casper.echo('Stack: ' + JSON.stringify(trace)); +}); +casper.options.logLevel ="debug"; + casper.start( - CasperUtils.getUrl(), + CasperUtils.getUrlForCommands([ + 'asd' + ]), function() { this.test.assertTitle('Learn Git Branching'); diff --git a/src/template.index.html b/src/template.index.html index 71c8cc84..9c41eabf 100644 --- a/src/template.index.html +++ b/src/template.index.html @@ -97,6 +97,15 @@ {{jsDependencies}} +