Open jbe456 opened 8 years ago
I'm facing the same issue. @jbe456, were you able to solve your problem?
No @andrewwakeling I didn't spend much time on this. I still have the issue although I did not try with more recent versions since then.
@andrewwakeling, i found a workaround just using the isparta-loader instead of the isparta-instrumenter loader. I followed the instructions here.
Basically, all I had to do was
src/tests.webpack.js
), add the following:
const tests = require.context(".", true, /.spec$/); tests.keys().forEach(tests);
const components = require.context('.', true, /index.js$/); components.keys().forEach(components);
isparta-instrumenter-loader
to isparta-loader
.Running your tests should result in a significant change in your coverage numbers.
I tried to do that, but I keep getting errors I can't solve:
ERROR in ./~/normalize.css/normalize.css
Module parse failed: /home/alexander/Workspace/MyProject/node_modules/normalize.css/normalize.css Unexpected token (9:5)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (9:5)
ERROR in ./~/svg-sprite-loader!./src/client/images/icons/motor.svg
Module build failed: TypeError: Must be an object
at exports.objectToAttrString (/home/alexander/Workspace/MyProject/node_modules/svg-sprite-loader/lib/utils.js:6:11)
at SVGDocument.toString (/home/alexander/Workspace/MyProject/node_modules/svg-sprite-loader/lib/svg-document.js:29:18)
at Object.module.exports (/home/alexander/Workspace/MyProject/node_modules/svg-sprite-loader/index.js:47:17)
The complete error log: https://gist.github.com/phun-ky/8f58b18061ae908e6a25e332114cafe5
Config: https://gist.github.com/phun-ky/72b3fd81556fc465144f15a873bdebb4 loadtests.js: https://gist.github.com/phun-ky/4dc5c2dd2dfba6a6b4d1d2be0e1b445d
client/index.js
is the entry point for the client code in webpack
Got it working now, with this setup: https://gist.github.com/phun-ky/715386135c588a05efa3fd33af3da436
Had to NOT include the first js file that renders the client (rookie mistake), and Only used isparta-loader in the preLoaders section
Hi there. For anyone still interested in this topic, Here is a tool, which helps to add untested files to coverage report. It works fine with both JavaScript and TypeScript files. https://github.com/kopach/karma-sabarivka-reporter As per my understanding, karma has limitation in detecting all source files, in case we pass only 1 file as starting point to our tests. E.g. as from example above:
files: [
'tests/EntryPoint.js'
],
This tool overcomes this limitation.
Using the
isparta-instrumenter
withwebpack
andkarma-coverage
I can't make the optionincludeAllSources
to work.Here is my webpack config:
Here is the
karma.conf.js
:I get the html output but the untested files are missing. Did anybody make this option work with
isparta-instrumenter
andwebpack
? I'm pretty sure there is no issue here but I can't find the correct configuration.I tried adding
coverage
as a preprocessor for my source file but it seems to fail because they are ES6 or JSX files.