Skip to content

Commit

Permalink
improved error output when test file cannot be loaded with using tags
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Nov 25, 2016
1 parent 2f0089e commit dea01d0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ coverage.html
selenium-debug.log
phantomjsdriver.log
tests_output
output
*~
\#*
\.#*
Expand Down
1 change: 0 additions & 1 deletion bin/runner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* Module dependencies
*/
var Logger = require('../lib/util/logger.js');
var Nightwatch = require('../lib/index.js');
var Utils = require('../lib/util/utils.js');

Expand Down
5 changes: 2 additions & 3 deletions lib/runner/cli/errorhandler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var Logger = require('../../util/logger.js');
var Utils = require('../../util/utils.js');

var ErrorHandler = module.exports = {
handle : function(err, results, finished) {
Expand Down Expand Up @@ -63,8 +64,6 @@ var ErrorHandler = module.exports = {
return;
}

var parts = stackTrace.split('\n');
process.stderr.write(Logger.colors.red(parts.shift()) + '\n');
process.stderr.write(parts.join('\n') + '\n\n');
Utils.showStackTraceWithHeadline('There was an error while starting the test runner:\n', err.stack + '\n', true);
}
};
File renamed without changes.
22 changes: 11 additions & 11 deletions test/src/runner/testFileMatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ module.exports = {
},

'tag: test loading modules containing an error should not be silent': function () {
var hasResolved = false;
try {
var tags = ['home', 'login', 'sign-up'];
var matched = FileMatcher.tags.match(path.join(__dirname, '../../mock-errors/sample-error.js'), {
tag_filter: tags
});
hasResolved = true;
} catch(err) {
assert.ok(err instanceof Error);
}
assert.ok(!hasResolved, 'should not have resolved');
var errorThrown;

try {
var tags = ['home', 'login', 'sign-up'];
FileMatcher.tags.match(path.join(__dirname, '../../mock-errors/sample-error.js'), {
tag_filter: tags
});
} catch(err) {
errorThrown = err;
}
assert.ok(errorThrown instanceof Error);
},

'tag: test matching numeric tags': function () {
Expand Down

0 comments on commit dea01d0

Please sign in to comment.