From edfb52fadccf10c34d885c37e990dea0efbb0081 Mon Sep 17 00:00:00 2001 From: Francesco Pipita Date: Wed, 10 Feb 2016 12:27:06 +0100 Subject: [PATCH] fix(configParser): use all the suites if no other spec sources are provided --- lib/configParser.js | 4 ++-- spec/unit/config_test.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/configParser.js b/lib/configParser.js index 69d197a4b..2881c3397 100644 --- a/lib/configParser.js +++ b/lib/configParser.js @@ -151,8 +151,8 @@ ConfigParser.getSpecs = function(config) { return config.specs; } - Array.prototype.forEach.call(config.suites, function(suite) { - union(specs, makeArray(suite)); + Object.keys(config.suites || {}).sort().forEach(function(suite) { + union(specs, makeArray(config.suites[suite])); }); return specs; }; diff --git a/spec/unit/config_test.js b/spec/unit/config_test.js index 15c655657..33a396d86 100644 --- a/spec/unit/config_test.js +++ b/spec/unit/config_test.js @@ -39,6 +39,22 @@ describe('the config parser', function() { expect(config.onPrepare).toEqual(path.normalize(process.cwd() + '/baz/qux.js')); }); + describe('getSpecs()', function() { + it('should return all the specs from "config.suites" if no other sources are provided', function() { + var config = { + specs: [], + suites: { + foo: 'foo.spec.js', + bar: 'bar.spec.js' + } + }; + + var specs = new ConfigParser.getSpecs(config); + + expect(specs).toEqual(['bar.spec.js', 'foo.spec.js']); + }); + }); + describe('resolving globs', function() { it('should resolve relative to the cwd', function() { spyOn(process, 'cwd').and.returnValue(__dirname + '/');