Closed darrenhaken closed 10 years ago
@darrenhaken I'm a bit confused as your comment is saying something different than this issue. I can see 2 issues:
config
objectActually I'm not sure I understand your second point, could you please elaborate?
Accessing the config object: I had the following karma.conf.js: https://gist.github.com/darrenhaken/4b910e2090a12953a52c This uses the config object in karma to define the level of logging e.g. logLevel: config.LOG_INFO, Since posting this issue I've discovered that you can pass a string to logLevel, which actually solves this problem!
Merging different settings:
In the sample project the following task is used to execute karma as a single run: gulp.task('test', function (done) { karma.start(_.assign({}, karmaCommonConf, {singleRun: true}), done); });
I found that if I had an external JS file with the config that the lodash assign function doesn't work.
@darrenhaken in your gist you are exporting a function from karma.conf.js so lodash merging of properties won't work here as it would try to merge an object with a function with your overrides. If you look at my initial PR (https://github.com/karma-runner/gulp-karma/commit/e0c025d543c23d6dfa15df4ea9c6eabfdcc6e3d9) you will notice that I was exporting an object from the karma-common-conf.js and then lodash knows how to deal with this.
Does it make sense?
Anyway, I'm planning to demonstrate how to handle "regular" karma conf files in #4
@darrenhaken this commit from #9 is probably what you were looking for.
As shown in the comments, I've used the karma.conf.js via require. However the lodash assign does not work to merge different settings for a single run.
Any ideas how to do this?