Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
feat(debugging): remove webdriver lines from stacktraces by default t…
Browse files Browse the repository at this point in the history
…o improve readability
  • Loading branch information
juliemr committed Dec 20, 2013
1 parent 643ca50 commit d44ef01
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
23 changes: 23 additions & 0 deletions lib/protractor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var url = require('url');
var util = require('util');
var path = require('path');
var webdriver = require('selenium-webdriver');

var clientSideScripts = require('./clientsidescripts.js');
Expand Down Expand Up @@ -658,3 +659,25 @@ exports.setInstance = function(ptor) {
exports.getInstance = function() {
return instance;
}

/**
* Utility function that filters a stack trace to be more readable. It removes
* Jasmine test frames and webdriver promise resolution.
* @param {string} text Original stack trace.
* @return {string}
*/
exports.filterStackTrace = function(text) {
if (!text) {
return text;
}
var jasmineFilename = 'node_modules/minijasminenode/lib/jasmine-1.3.1.js';
var seleniumFilename = 'node_modules/selenium-webdriver';
var lines = [];
text.split(/\n/).forEach(function(line){
if (line.indexOf(jasmineFilename) == -1 &&
line.indexOf(seleniumFilename) == -1) {
lines.push(line);
}
});
return lines.join('\n');
}
3 changes: 2 additions & 1 deletion lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var config = {
jasmineNodeOpts: {
isVerbose: false,
showColors: true,
includeStackTrace: true
includeStackTrace: true,
stackFilter: protractor.filterStackTrace
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Julie Ralph <ju.ralph@gmail.com>",
"dependencies": {
"selenium-webdriver": "~2.37.0",
"minijasminenode": "~0.2.6",
"minijasminenode": ">=0.2.7",
"saucelabs": "~0.1.0",
"glob": ">=3.1.14",
"adm-zip": ">=0.4.2",
Expand Down

0 comments on commit d44ef01

Please sign in to comment.