Skip to content

Commit

Permalink
Fix 1766: stackfilter should not ignore node_modules
Browse files Browse the repository at this point in the history
Closes #1766
Closes #1767

Signed-off-by: Joshua Appelman <jappelman@xebia.com>
  • Loading branch information
danielstjules authored and Joshua Appelman committed Jul 5, 2015
1 parent d5ddcdc commit 2952eca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
8 changes: 1 addition & 7 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,6 @@ exports.stackTraceFilter = function() {
? process.cwd() + slash
: (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');

function isNodeModule(line) {
return (~line.indexOf('node_modules'));
}

function isMochaInternal(line) {
return (~line.indexOf('node_modules' + slash + 'mocha'))
|| (~line.indexOf('components' + slash + 'mochajs'))
Expand All @@ -726,9 +722,7 @@ exports.stackTraceFilter = function() {
stack = stack.split('\n');

stack = exports.reduce(stack, function(list, line) {
if (is.node && (isNodeModule(line)
|| isMochaInternal(line)
|| isNodeInternal(line))) {
if (is.node && (isMochaInternal(line) || isNodeInternal(line))) {
return list;
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module.exports = {

// Ignore empty lines before/after diff
return diffs.map(function(diff) {
return diff.slice(1, -1).join('\n');
return diff.slice(1, -2).join('\n');
});
}
};
Expand Down
3 changes: 2 additions & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ describe('utils', function() {
, 'next (/usr/local/lib/node_modules/mocha/lib/runner.js:248:23)'
, 'Immediate._onImmediate (/usr/local/lib/node_modules/mocha/lib/runner.js:276:5)'
, 'at processImmediate [as _immediateCallback] (timers.js:321:17)'];
filter(stack.join('\n')).should.equal(stack.slice(0,2).concat(stack.slice(5,7)).join('\n'));

filter(stack.join('\n')).should.equal(stack.slice(0,7).join('\n'));
});

it('should ignore bower and components files', function() {
Expand Down

0 comments on commit 2952eca

Please sign in to comment.