Generate code coverage of coffeescript with webpack and karma - coffeescript

Is there any way to generate accurate code coverage for Coffeescript using Webpack and Karma? There is not much literature on the internet to get this working. I have tried to use karma-sourcemap-loader to no avail.

Related

How do I make a Karma compliant test harness for the browser?

My guess is that the Karma test runner does not hook in Mocha and Jasmine, rather the reverse.
so I assume Mocha and Jasmine call something like this:
window.__karma__.testCasePassed(data);
window.__karma__.testCaseFailed(data);
and then Karma will report these events.
I am writing Suman and I want to figure out if I can make Suman Karma compliant.
When I look through the Mocha and Jasmine codebase however, I am not seeing the evidence I am looking for.
You won't find anything in the code of Mocha or Jasmine themselves as they don't know anything about Karma. When you use Mocha and Jasmine in Karma you have to use karma-mocha and karma-jasmine. These are the packages that bridge Mocha and Jasmine on the one hand, and Karma on the other.
If you look at karma-mocha, you'll see that it has a function called createMochaReporterConstructor which creates a Mocha reporter that calls function on window.__karma__. (You can see it called here and the first argument is window.__karma__.)
There is a bit of documentation about the Karma framework API on this page (search for "Karma Framework API" to get to it). It is a very brief description though. If it were me, I'd look at the code of karma-mocha and karma-jasmine to have a better idea of how to use it.

how to generate logs using log4js-protractor-appender in angular/cli project using typescript

i have tried using log4js-protractor-appender for e2e testing using protractor in angular cli project by following link Writing a log file for Protractor/Jasmine tests without using command line
I think you should use jasmine or mocha for reporting your test results. Hope it will help you. How can I save protractor test results

Integrated coverage using scoverage for scala code and test cases written in python

I am trying to get test coverage for Scala project.
1.Test cases are written in python.
2.Need to run multiple test cases at same time and finally get coverage report. Its like integrated test coverage.
Referring https://github.com/scoverage/sbt-scoverage for scoverage. Any suggestion how can I execute it?

Structuring webpack config for use with karma testing

I would like to create a test suite which will be run with karma against my app which is using webpack to build itself. I have two entrypoints, app and vendors. These are set up through my webpack.config.js file here. The resulting bundle.js should contain both of these entrypoints in its generated file.
My karma (mocha) tests residing in test/spec/*_spec.js are currently pointing to specific components, via require statements like:
var app = require('../src/scripts/App')
They also utilize react/jsx which seems to be causing problems during the test run where I get jsx errors:
Module parse failed: /Users/dmarr/src/status/test/spec/app_spec.js Line 10: Unexpected token <
You may need an appropriate loader to handle this file type.
I'd like to keep test runs quick as possible as well as fast build times for testing with webpack-dev-server during development by minimizing babel transforms to only where needed.
What do I need to do in karma.conf.js to get my builds working? Here is the karma.conf.js file I'm playing around with.
Note, that I do have this working without breaking out the vendor bundle here: https://github.com/bitwise/status
Thanks for any help,
Dave
In a similar setup, disabling CommonsChunkPlugin (for testing only) worked for me. Give it a shot!

Ember-cli: importing blanket.js causes test runners to hang

I'm currently using ember-cli with ember-qUnit for testing. I would also like to add code coverage results to the test output, so after some research blanketjs seemed the way to go. I installed blanket using:
npm install blanket
And moved the blanket folder into the ember-cli vendor folder. As I understand the way to import libraries is through the Brocfile.js which I am doing like so:
app.import('vendor/blanket/dist/qunit/blanket.js');
Using ember inspector it appears that blanket has been imported correctly, and the "enable coverage" checkbox has appeared at the top of the qUnit test results page. However the tests just hang and just say "running". No tests seem to run. When I use:
ember test -server
It says that it is "waiting for runners". Does anyone know what could be going wrong here?
I've looked around and it seems code-coverage with ember-cli is a tricky subject:
Ember CLI Code Coverage Reports
Thanks
I installed it using ember-cli-blanket. I don't think you need to include it in your Brocfile.js, but instead import it in your tests/index.html after you import your test-support.js.
Blanket will probably make your runners hang for a big as it is essentially loading you entire app all over again.
For what it's worth, I haven't been able to get accurate test coverage using this method yet, but it's possibly user error.