☕️ Classic, reliable, trusted test framework for Node.js and the browser
Fixes #124 and fixes #166 - Changes the name of the suite.iterateTests() function to suite.eachTest(), and replaces forEach by util.forEach() for browser compatibility.
Xavier Antoviaque5be944a3a5a8
diff --git a/lib/runner.js b/lib/runner.jsindex 09e202a6..9f550879 100644--- a/lib/runner.js+++ b/lib/runner.js@@ -82,7 +82,7 @@ Runner.prototype.grepTotal = function(suite) {var self = this;var total = 0;- suite.iterateTests(function(test){+ suite.eachTest(function(test){if (self._grep.test(test.fullTitle())){total++;};diff --git a/lib/suite.js b/lib/suite.jsindex b17b2c89..c76c48ac 100644--- a/lib/suite.js+++ b/lib/suite.js@@ -256,13 +256,13 @@ Suite.prototype.total = function(){* @api public*/-Suite.prototype.iterateTests = function(fn){+Suite.prototype.eachTest = function(fn){var self = this;- self.tests.forEach(function(test){+ utils.forEach(self.tests, function(test){fn(test);});- self.suites.forEach(function(suite){- suite.iterateTests(fn);+ utils.forEach(self.suites, function(suite){+ suite.eachTest(fn);});return this;};diff --git a/test/suite.js b/test/suite.jsindex 2b8865d6..d5b664cb 100644--- a/test/suite.js+++ b/test/suite.js@@ -250,7 +250,7 @@ describe('Suite', function(){});});- describe('.iterateTests(fn)', function(){+ describe('.eachTest(fn)', function(){beforeEach(function(){this.suite = new Suite('A Suite');});@@ -261,7 +261,7 @@ describe('Suite', function(){function fn(){counter++;}- this.suite.iterateTests(fn);+ this.suite.eachTest(fn);counter.should.equal(0);});});@@ -275,7 +275,7 @@ describe('Suite', function(){function fn(){counter++;}- this.suite.iterateTests(fn);+ this.suite.eachTest(fn);counter.should.equal(2);});});@@ -291,7 +291,7 @@ describe('Suite', function(){function fn(){counter++;}- this.suite.iterateTests(fn);+ this.suite.eachTest(fn);counter.should.equal(2);});});