diff --git a/lib/config.js b/lib/config.js index 57cf4aa04..e305e46ba 100644 --- a/lib/config.js +++ b/lib/config.js @@ -300,6 +300,7 @@ var parseConfig = function (configFilePath, cliOptions) { } var config = new Config() + config.set(cliOptions) try { configModule(config) diff --git a/test/unit/config.spec.js b/test/unit/config.spec.js index 58e769392..2c78ab2f9 100644 --- a/test/unit/config.spec.js +++ b/test/unit/config.spec.js @@ -38,6 +38,7 @@ describe('config', () => { '/home/config4.js': wrapCfg({port: 123, autoWatch: true, basePath: '/abs/base'}), '/home/config6.js': wrapCfg({reporters: 'junit'}), '/home/config7.js': wrapCfg({browsers: ['Chrome', 'Firefox']}), + '/home/config8.js': config => config.set({ files: config.suite === 'e2e' ? ['tests/e2e.spec.js'] : ['tests/unit.spec.js'] }), '/conf/invalid.js': () => { throw new SyntaxError('Unexpected token =') }, '/conf/exclude.js': wrapCfg({exclude: ['one.js', 'sub/two.js']}), '/conf/absolute.js': wrapCfg({files: ['http://some.com', 'https://more.org/file.js']}), @@ -144,6 +145,14 @@ describe('config', () => { expect(config.browsers).to.deep.equal(['Safari']) }) + it('should have access to cli options in the config file', () => { + var config = e.parseConfig('/home/config8.js', {suite: 'e2e'}) + expect(patternsFrom(config.files)).to.deep.equal([resolveWinPath('/home/tests/e2e.spec.js')]) + + config = e.parseConfig('/home/config8.js', {}) + expect(patternsFrom(config.files)).to.deep.equal([resolveWinPath('/home/tests/unit.spec.js')]) + }) + it('should resolve files and excludes to overriden basePath from cli', () => { var config = e.parseConfig('/conf/both.js', {port: 456, autoWatch: false, basePath: '/xxx'})