-
Notifications
You must be signed in to change notification settings - Fork 64
html reports fail w/ v1 #32
Comments
most likely it should be fixed with karma-runner/karma-coverage#251 because new @DatenMetzgerX any suggestions? |
I'm also using karma-coverage, but without the html report. I'm just creating the JSON output and post process the created JSON file using remap-istanbul. But to be honest, my setup is quite complicated as I have to use many custom branches to map the coverage information back to the original typescript source. As your setup is simpler then mine, maybe you can use nyc until karma-coverage is updated. Or how does your complete webpack setup looks like? You still have to use karma-coverage to collect the test results but you use the JSON output instead of the html output. You have to store the JSON result in the You can then use nyc to create your html report
This will create the report in the ./coverage directory This does not work in all cases if you are using typescript. The coverage information will not be correctly remapped to the source code. Therefore additional extensions are needed, see #29 |
Here is my webpack config: var isDev = process.env.NODE_ENV !== 'production'
var CopyWebpackPlugin = require('copy-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var webpack = require('webpack')
var path = require('path')
var htmlPlugin = new HtmlWebpackPlugin({
template: 'index.html'
})
var cwp = new CopyWebpackPlugin(
[
{from: './assets', to: './assets'}
]
)
module.exports = {
context: path.join(__dirname, 'src'),
devtool: isDev ? 'inline-sourcemap' : null,
entry: './js/client.js',
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-html-attrs', 'transform-class-properties']
}
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /\.(png|gif)$/,
loader: 'file?name=[path][name].[ext]'
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file'
}, {
test: /\.(woff|woff2)$/,
loader: 'url?prefix=font/&limit=5000'
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=application/octet-stream'
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&mimetype=image/svg+xml'
}
]
},
output: {
path: __dirname + '/dist/',
filename: 'client.min.js'
},
plugins: isDev ? [
new ExtractTextPlugin('site.css'),
htmlPlugin,
cwp
] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: true, sourcemap: true }),
new ExtractTextPlugin('site.css'),
htmlPlugin,
cwp
]
} I tried your suggestion of using nyc to process the json file. It ran without errors, but produced similar problems: I'll try out the remap-istanbul tool later today. |
my solution is to stuck with an old 0.x version until karma-runner/karma-coverage#251 is merged in. that's why we had a major bump here, to not automatically break your stuff by semver :) |
Thanks - I had this same issue where I was trying to use the HTML coverage reporter in my karma configuration and it wasn't working. Pinning to For better visibility, would it be possible to add a note to the README or a CHANGELOG indicating the issue? in
Also, could you create tags for the older releases? I only started using this module yesterday. I assumed there was only 1 version because when I glanced at github I only saw a single release tag for v1.0.0 and no changelog, so it wasn't obvious there were any older versions or any breaking changes. |
+1 |
Reverted istanbul-instrumter-loader ref webpack-contrib/istanbul-instrumenter-loader#32
Reverted istanbul-instrumter-loader ref webpack-contrib/istanbul-instrumenter-loader#32
I wrote this karma reporter today that you can use as an alternative to the https://github.com/mattlewis92/karma-coverage-istanbul-reporter |
+1 , downgrading to 0.2.0 solved my problem. |
I am facing the same error and i can't find 0.2.0 on the git repo. is 0.2.0 still usable, any ideas if this isfixed in higher versions of istanbul-instrumenter-loader or karma-coverage ? |
When using the following config:
The coverage results do get printed to the terminal, however immediately after that I get this error:
The text was updated successfully, but these errors were encountered: