karma-runner / karma-mocha

A Karma plugin. Adapter for Mocha testing framework.
MIT License
379 stars 95 forks source link

Redundant Mocha Reporter Node <div id="mocha"></div> #225

Open chrisbottin opened 4 years ago

chrisbottin commented 4 years ago

Hi,

I've noticed the node <div id="mocha"></div> is created by this plugin whenever I'm running karma in debug mode and the mocha reporter is set to "spec".

This node is only used by the mocha HTML reporter so ...

Should this code

https://github.com/karma-runner/karma-mocha/blob/bb5be9b83d0b76e315368cbd1a9b453ff2e52590/src/adapter.js#L122-L125

be changed to check which reporter is used like this?

if (isDebugPage && haveMochaConfig(tc) && tc.config.mocha.reporter === 'html') {
    createMochaReporterNode()
    return tc.config.mocha.reporter
}
chrisbottin commented 4 years ago

btw, happy to create a PR for it if the changes are sound.