☕️ Classic, reliable, trusted test framework for Node.js and the browser
Fix 1766: stackfilter should not ignore node_modules
Daniel St. Jules2952eca30c62
diff --git a/lib/utils.js b/lib/utils.jsindex 7e102ee1..e7b9eee9 100644--- a/lib/utils.js+++ b/lib/utils.js@@ -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'))@@ -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;}diff --git a/test/integration/helpers.js b/test/integration/helpers.jsindex eea8b185..7187d9d7 100644--- a/test/integration/helpers.js+++ b/test/integration/helpers.js@@ -98,7 +98,7 @@ module.exports = {// Ignore empty lines before/after diffreturn diffs.map(function(diff) {- return diff.slice(1, -1).join('\n');+ return diff.slice(1, -2).join('\n');});}};diff --git a/test/utils.js b/test/utils.jsindex 524a0e05..31b49893 100644--- a/test/utils.js+++ b/test/utils.js@@ -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() {