diff --git a/api.js b/api.js index fad5c7c959..ce509eb157 100644 --- a/api.js +++ b/api.js @@ -160,11 +160,11 @@ Api.prototype.run = function () { if (++statsCount === self.fileCount) { self.emit('ready'); - tests.forEach(function (test) { - test.run(); - }); + var method = self.serial ? 'mapSeries' : 'map'; - deferred.resolve(Promise.all(tests)); + deferred.resolve(Promise[method](files, function (file, index) { + return tests[index].run(); + })); } }