karma-mocha icon indicating copy to clipboard operation
karma-mocha copied to clipboard

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

Open chrisbottin opened this issue 4 years ago • 1 comments

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 avatar May 29 '20 16:05 chrisbottin

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

chrisbottin avatar May 29 '20 16:05 chrisbottin