Comments (6)
I have been able to make it work, here are my changes :
tsconfig.json
"compilerOptions": {
"inlineSourceMap": true,
}
webpack-test.conf.js
postLoaders : [
{
test: /^((?!\.spec\.ts).)*.ts$/,
exclude: /(node_modules|tests)/,
loader: 'istanbul-instrumenter' // used to to get the code coverage for TypeScript
}
];
karma.conf.js
reporters: ['progress', 'coverage'],
coverageReporter: {
reporters: [
{
dir: 'coverage',
subdir: '.',
type: 'json'
}
]
},
plugins: [
require('karma-coverage'),
]
Then in gulp_tasks/karma.js
const remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
gulp.task('remap-istanbul', function() {
return gulp.src('coverage/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'json': 'coverage/coverage-final.json',
'html': 'coverage/html'
}
}));
});
gulpfile.js
gulp.task('test', gulp.series('karma:single-run', 'remap-istanbul'));
Then do not forget to install the dependencies.
npm i --save-dev istanbul-instrumenter-loader karma-coverage remap-istanbul
And now you should be able to get the code coverage for you project.
BONUS : since the sourcemap is done in TypeScript, you can remove the one from webpack
webpack-test.conf.js
devtool: false;
from generator-fountain-webapp.
I don't know any satisfying solution to have coverage for TS. So right now, there is none.
from generator-fountain-webapp.
How about Chutzpah or remap-instanbull?
http://stackoverflow.com/questions/17026959/code-coverage-for-typescript
from generator-fountain-webapp.
@prbaron Thanks for the hack, I just had an issue with the postLoader, none of my .ts were processed, I had to change the regex used:
postLoaders : [
{
test: /\.ts$/,
exclude: /(node_modules|tests|(.spec\.ts))/,
loaders: ['istanbul-instrumenter'] // used to to get the code coverage for TypeScript
}
]
from generator-fountain-webapp.
@Nephidream You are correct. The right regex is test: /^((?!\.spec\.ts).)*.ts$/
. I updated my answer according to it.
from generator-fountain-webapp.
Sorry for the delay. This is great, we should include it.
from generator-fountain-webapp.
Related Issues (20)
- What is the suggested way to add middleware or a database to a Fountain setup? HOT 2
- gulp: remote branch not found (gulpjs/gulp#4ed9a4a3275559c73a396eff7e1fde3824951ebb) HOT 5
- Why wiredep exclude bootstrap by default?? HOT 1
- Prompt freezes HOT 1
- yo fountain-webapp -> throw er; HOT 1
- Support for webpack with multiple entries
- UNMET PEER DEPENDENCY [email protected] HOT 1
- Bug: ng-annotate-loader and babel-loader break Source Maps.
- Webpack watch performance HOT 1
- can't deploy it on heroku at all please need help HOT 1
- how to use dynamic meta tags for fountainjs i tried to use many modules nothing is working.
- error TS2415: Class 'WebSocketSubject<T>' incorrectly extends base class 'AnonymousSubject<T>'. HOT 1
- *.ts Files not Transpiled by Default HOT 1
- Error in fresh install of TodoMVC sample app (./src/app/components/TodoTextInput.js)
- fresh install cannot build
- Sourcemaps are not generated in Angular1/Typescript/Webpack build HOT 1
- SyntaxError in browser-sync HOT 1
- [Angular 1 JSPM] Is it possible to separate code in two bundles (app/vendor)
- Update all dependencies HOT 1
- is this project still manteined? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator-fountain-webapp.