-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
TypeScript support? #176
Comments
I tried |
@JaKXz good find, I should definitely promote
Could you link me to an OSS project of yours that has |
@bcoe https://github.com/JaKXz/webpack-ts-demo/tree/chore/use-nyc is an old project, spent some time this morning updating it and cleaning up some errors. That branch has a pretty similar setup to what I've described here, with one Feel free to email me if you need anything. Thanks for looking into this! 😄 JaKXz/webpack-ts-demo#3 |
@JaKXz any progress on this, hope things are going well. |
@bcoe I haven't had any luck, no :( thanks for asking! Was my project / branch installable without issues? |
I did use |
@bcoe I also tried here: JaKXz/angular2-redux-starter@ec82374 using |
@JaKXz nyc can handle source maps out of the box now, provided the source maps are available when it instruments the source files. I'm not sure how well it would work with Karma though. In your branch you seem to be hooking up Istanbul yourself which might conflict with nyc. And nyc might not work great with a Webpack bundle either. |
@novemberborn good catch, but removing the postLoader didn't work either. My guess for sourcemaps was that they should be inline for |
More and more it just looks like the |
@JaKXz I noticed a problem with the documentation digging into your problem, which I corrected You are using
|
@bcoe thanks for the response. I fixed the typo in |
@JaKXz tldr; rather than using
//TODO use object.assign here
exports.typescript = {
test: /\.ts$/,
loaders: ['ng-annotate', 'istanbul-instrumenter', 'ts'],
exclude: /\.spec\.ts$/
};
exports.typescriptTest = {
test: /\.ts$/,
loaders: ['ng-annotate', 'istanbul-instrumenter', 'ts']
};
reporters: ['mocha', 'coverage'],
PS., I'm flying in from Oakland and talking at Toronto JavaScript on the 22nd, if you happen to be around. |
@bcoe thanks for the support! That is pretty much as far as I'd gotten before but I was hoping that I could instrument the actual Looking forward to meeting you! 😄 |
I'll leave it here: Setting up test coverage using Mocha, Istanbul, NYC with TypeScript Thanks for the amazing work! ❤️ |
@mohsen1 this is wonderful, mind if I put a copy on our IstanbulJS website? |
Not at all! I copied all of your code in my project! ;) |
I've managed to get this to work
package.json
.nycrc{
"extension": [
".ts"
],
"reporter": [
"html",
"text-summary"
],
"cache": true,
"sourceMap": false,
"instrument": false
} mocha-webpack.opts
config/webpack/tests.js:var path = require('path');
var path = require('path');
var nodeExternals = require('webpack-node-externals');
var config = {
target: 'node',
externals: [ nodeExternals() ],
output: {
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
},
devtool: 'inline-source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
module: {
rules: [{
test: /\.ts?$/,
include: path.resolve('src'),
exclude: /node_modules/,
rules: [{
test: () => process.env.NODE_ENV === 'coverage',
exclude: /\.spec.ts?$/,
enforce: 'post',
loader: 'istanbul-instrumenter-loader',
}, {
loader: 'awesome-typescript-loader',
}, {
test: () => process.env.NODE_ENV !== 'coverage' ,
enforce: 'pre',
loader: 'tslint-loader'
}]
}]
}
};
module.exports = config; |
@seanpoulter you mentioned:
Would this be possible to do while running mocha against I run coverage against the |
@Nava2 @seanpoulter I recently created a slack channel for |
@seanpoulter were you able to get the all flag working so all files (even the ones that aren't required in your tests) will show up in the coverage report. |
I don't recall trying that @nikmash, sorry. |
So what I found is that when using the |
Can anybody provide the working configuration for JS + NYC + MOCHA-WEBPACK, i tried below config, but get a blank coverage report
package.json
|
This article was invaluable to me, but returned a 404; so here's the up-to-date URL: Setting up test coverage using Mocha, Istanbul, NYC with TypeScript |
I'm having a problem with the configuration of the coverage of my project, where I'm using Vue.Js, Quasar framework and Typescript. Coverage reports are returning all files, but the files are not read in the coverage. Dependencies -> nyc, @cypress-coverage, @istanbuljs/nyc-config-typescript, coveralls, istanbul-instrumenter-loader, istanbul-lib-coverage, @cypress/webpack-preprocessor and babel/preset-typescript. Files Babel.config.js -> module.exports = { |
When scanning through the issues, there was a hint that theoretically, TypeScript could be possible to instrument and produce coverage for.
This is my first guess in my
package.json
for an Angular 2 project using karma:and I'm just getting an empty table.
The text was updated successfully, but these errors were encountered: