Skip to content

Instantly share code, notes, and snippets.

@jbpros
Last active December 15, 2015 11:02
Show Gist options
  • Save jbpros/9975976 to your computer and use it in GitHub Desktop.
Save jbpros/9975976 to your computer and use it in GitHub Desktop.
// features/support/stack_filter.js
module.exports = function () {
var path = require('path');
var filteredPathPrefix = path.resolve(__dirname, '..', '..');
var originalPrepareStackTrace;
if (originalPrepareStackTrace = Error.prepareStackTrace) {
Error.prepareStackTrace = function (error, stack) {
var originalString = originalPrepareStackTrace(error, stack);
var string = 'Error: ' + error.message + "\n";
var lines = originalString.replace('Error: ' + error.message + "\n", '').replace(/\s*$/, '').split("\n");
var i;
for (i = 0; i < lines.length; i++) {
var line = lines[i];
var callSite = stack[i];
if (callSite.getFileName().indexOf(filteredPathPrefix) == 0)
string = string + line + "\n";
};
return string;
};
}
};
@shteou
Copy link

shteou commented Dec 15, 2015

Hi Julien, do you have any explicit licensing for your gists?
Can I treat this as MIT, as with CucumberJS?
Thanks, and kind regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment