-
Notifications
You must be signed in to change notification settings - Fork 96
feature: Pass client configuration to `mocha.setup method. #15
feature: Pass client configuration to `mocha.setup method. #15
Conversation
If this works now... doesn't this mean that the readme needs to be updated? |
var passedIn = karma.config.mocha; | ||
|
||
// Overwrite reporter because otherwise everything breaks down. | ||
passedIn.reporter = defaultConfig.reporter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will leak memory, you should not modify the karma.config
as that is in the parent (long life) frame.
Let's create a clone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACtually, this might be better:
var mochaConfig = {
reporter: createMochaReporterConstructor(window.__karma__),
ui: 'bdd',
globals: ['__cov*']
};
if (window.__karma__.config && window.__karma__.config.mocha) {
// copy all the properties (except reporter) from window.__karma__.mocha to mochaConfig
// + the globals merging
}
This should work, as there's gonna be only references from the child frame to parent, not the other way around.
@dignifiedquire this is awesome! Check out my code, can you refactor it please? |
Now all configuration in `client.config.mocha` is passed to the setup method of mocha. The default ui style of `'bdd'` is still set if nothing else is supplied. Also the reporter will be always overridden as this needs to be our custom one. Fixes karma-runner#13.
@vojtajina ping |
feature: Pass client configuration to `mocha.setup method.
Thanks @dignifiedquire you are fast! Btw, it's |
I guess I just type so fast that I try to be more descriptive than I need to be ;) |
Rebased to 4df9ba6, otherwise it wouldn't get released neither it would get into changelog. |
Now all configuration in
client.config.mocha
is passed to thesetup method of mocha. The default ui style of
'bdd'
is stillset if nothing else is supplied. Also the reporter will be always
overridden as this needs to be our custom one.
Fixes #13.
I know that tests are missing but I'm not sure how it's possible to test this with the current testing setup.