webpack-contrib / istanbul-instrumenter-loader

Istanbul Instrumenter Loader
MIT License
273 stars 65 forks source link

istanbul-instrumenter with karma, TypeScript and webpack #34

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, I'm using TypeScript via webpack, with one entry point for the source and one entry point for the tests.

Here is my webpack.conf.js file:

module.exports = { debug: true, devtool: 'inline-source-map', output: { filename: 'all.min.js', }, module : { loaders : [ { test: /.tsx?$/, include: path.resolve(dirname, 'src/'), loader: 'ts-loader' } ], postLoaders: [ // instrument only testing sources with Istanbul { test: /.tsx?$/, include: path.resolve(dirname, 'src/'), loader: 'istanbul-instrumenter' } ] } }

When adding istanbul-instrumenter as postLoaders it's really working well and I can see all the files separated like I want, but unfortunate I receive this error:

TypeError: Cannot read property 'split' of undefined] TypeError: Cannot read property 'split' of undefined at HtmlReport.Report.mix.writeDetailPage

When removing it, all works, but one big bundled file will be exported to the html report.

Can you help me with that?

Thanks, Best Regards

ghost commented 8 years ago

Even I tried going on one entry webpack for the source and run all the tests separably through test/*..test.ts ['webpack'] preprocessor, and that doesn't work neither :(

Shadowblazen commented 8 years ago
TypeError: Cannot read property 'split' of undefined
at HtmlReport.Report.mix.writeDetailPage

^ Based on this error (I was getting the same thing), it looks like you're using the HTML coverage reporter, which is the same issue as https://github.com/deepsweet/istanbul-instrumenter-loader/issues/32. Do the suggestions there resolve your issue?

ghost commented 8 years ago

I solved the issue by completely COPYING from this repo: https://github.com/zbicin/angular-webpack-typescript-karma-coverage

Thanks anyway

factoidforrest commented 6 years ago

That's for webpack 1, we are now on webpack 3.

ghost commented 6 years ago

You're right. This issue closed years ago :laughing: