New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage configuration with fast run and debug #183
Comments
Related WebStorm issue: https://youtrack.jetbrains.com/issue/WEB-17537 |
I'm sorry, maybe I'm being thick but what exactly would you like to see ideally in terms of features from |
No problem. Generally, I would like to see a clear way that would allow to run(fast)/debug/run-with-coverage using single configuration file. Previously, there was some way, but as it turned out that way does not play well with recommended coffee configuration. For example, the fix could be in changing this recommended configuration (not sure it's the best solution). |
@dignifiedquire I've changed slightly how IntelliJ integration disables coverage to have faster test runs/debug capabilities. New logic: if (canCoverageBeDisabledSafely(config.coverageReporter)) {
var ind = reporters.indexOf(karmaCoverageReporterName);
if (ind >= 0) {
reporters.splice(ind, 1);
console.log('IntelliJ integration disabled coverage for faster run and debug capabilities');
}
}
/**
* @param {Object} coverageReporter
* @returns {boolean} true if tests can be successfully run without coverage reporter and preprocessor
*/
function canCoverageBeDisabledSafely(coverageReporter) {
return coverageReporter == null || (
!Object.prototype.hasOwnProperty.call(coverageReporter, 'instrumenter') &&
!Object.prototype.hasOwnProperty.call(coverageReporter, 'instrumenters')
);
} This logic tries to preserve |
Related discussion karma-runner/karma#630
As expected coverage slows down test run and makes debugging impossible.
The workaround is to maintain two configs - the first one with coverage configured, and the second without coverage.
To improve the situation, there is a feature that allows external integrations (e.g. IDE) to turn off
coverage
preprocessor by removingcoverage
reporter: https://github.com/karma-runner/karma-coverage/blob/v0.5.1/lib/preprocessor.js#L54This feature has been using by IntelliJ integration until a configuration that need
coverage
preprocessor for test run has emerged: https://github.com/karma-runner/karma-coverage/blob/v0.5.1/examples/coffee/karma.conf.coffeeNow IntelliJ uses a new trick to perform "Run", "Debug" and "Run with Coverage" actions with single karma.conf.js. However, it expects one thing from users - they should remove
coverage
reporter ifcoverage
preprocessor is not needed for test run (still common use case, IMO):coverage
reporter is not set in config (done by users)coverage
reporter is added on-the-fly by IntelliJ integration (https://github.com/karma-runner/karma-intellij/blob/2f63c75ea451d25fb17346abf8813e611d5e94f7/lib/intellijCoverageReporter.js#L19).The downsides of the current approach:
It'd be appreciated if it would be possible to improve the situation. A possible solution could be changing current coffeescript recommended configuration by making it possible to run tests without required coverage preprocessor. Also that would speed up tests.
Thanks.
The text was updated successfully, but these errors were encountered: