angular - Karma Coverage not finding files (angular2 / typescript) -
i working on getting app set using angular 2 w/ typescript , i'm having issues getting karma coverage find files want inspect. i've set on angular 1.x application there seems layer i'm missing typescript.
everything runs fine, see of unit tests being checked karma expected , coverage says okay , code has 100% coverage, threw red flag. after checking html output coverage saw have 100% coverage because no files being checked.
looking @ output in terminal see of files have selected pattern: './src/**/*.js' being excluded, means finding .ts files , not compiling them js.
i see message in terminal above coverage output says "not files specified in sources found, continue partial remapping."
i had added typescriptpreprocesser thinking convert ts files js files during testing coverage tool parse them, nothing i've done far working.
here's karam.conf.js file in it's entirety:
var path = require('path'); var webpackconfig = require('./webpack.config'); module.exports = function (config) { var _config = { // base path used resolve patterns (eg. files, exclude) basepath: '', // frameworks use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns load in browser files: [ { pattern: './karma-shim.js', watched: false }, { pattern: './src/**/*.js', included: true } ], // list of files exclude exclude: [ './src/e2e/*' ], // preprocess matching files before serving them browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { './karma-shim.js': ['webpack', 'sourcemap'], './src/**/*.ts': ['typescript'], './src/**/*.js': ['coverage'] }, typescriptpreprocessor: { // options passed typescript compiler options: { sourcemap: false, // (optional) generates corresponding .map file. target: 'es5', // (optional) specify ecmascript target version: 'es3' (default), or 'es5' module: 'amd', // (optional) specify module code generation: 'commonjs' or 'amd' noimplicitany: true, // (optional) warn on expressions , declarations implied 'any' type. noresolve: true, // (optional) skip resolution , preprocessing. removecomments: true, // (optional) not emit comments output. concatenateoutput: false // (optional) concatenate , emit output single file. default true if module option omited, otherwise false. }, // transforming filenames transformpath: function(path) { return path.replace(/\.ts$/, '.js'); } }, webpack: webpackconfig, webpackmiddleware: { // webpack-dev-middleware configuration // i. e. stats: 'errors-only' }, coveragereporter: { dir: 'coverage/', reporters: [{ type: 'html', dir: 'coverage' }] }, remapistanbulreporter: { src: 'coverage/json/coverage-final.json', reports: { lcovonly: 'coverage/json/lcov.info', html: 'coverage/html', 'text': null }, timeoutnotcreated: 1000, // default value timeoutnomorefiles: 1000 // default value }, webpackserver: { noinfo: true // please don't spam console when running in karma! }, // test results reporter use // possible values: 'dots', 'progress', 'mocha' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ["mocha", "coverage", "karma-remap-istanbul"], // web server port port: 9876, // enable / disable colors in output (reporters , logs) colors: true, // level of logging // possible values: config.log_disable || config.log_error || config.log_warn || config.log_info || config.log_debug loglevel: config.log_info, // enable / disable watching file , executing tests whenever file changes autowatch: false, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['chrome'], // can use chrome // continuous integration mode // if true, karma captures browsers, runs tests , exits singlerun: true }; config.set(_config); };
my terminal output incase helps:
> karma start start: 10 06 2016 16:32:20.696:warn [watcher]: files matched "/users/efarl1/desktop/repos/cmg-prod/src/**/*.js" excluded. webpack: wait until bundle finished: ts-loader: using typescript@1.8.10 , /users/efarl1/desktop/repos/cmg-prod/tsconfig.json webpack: bundle valid. 10 06 2016 16:32:35.364:info [karma]: karma v0.13.22 server started @ http://localhost:9876/ 10 06 2016 16:32:35.367:info [launcher]: starting browser chrome 10 06 2016 16:32:36.132:info [chrome 51.0.2704 (mac os x 10.11.5)]: connected on socket /#asaknul4k3m9g7wlaaaa id 96149396 appcomponent ✔ should log ngoninit log: 'three.webglrenderer', '73' log: 'three.webglrenderer', '73' productviewportcomponent ✔ productviewportcomponent should have h1 `productviewport component` in productcameraservice ✔ should log ngoninit productclickedobjectservice ✔ should log ngoninit productcontrolsservice ✔ should log ngoninit producteventsservice ✔ should log ngoninit productrendererservice ✔ should log ngoninit productservice ✔ should log ngoninit windowservice ✔ should log ngoninit finished in 0.295 secs / 0.241 secs summary: ✔ 9 tests completed not files specified in sources found, continue partial remapping. ----------|----------|----------|----------|----------|----------------| file | % stmts | % branch | % funcs | % lines |uncovered lines | ----------|----------|----------|----------|----------|----------------| ----------|----------|----------|----------|----------|----------------| files | 100 | 100 | 100 | 100 | | ----------|----------|----------|----------|----------|----------------|
any thoughts on i'm doing wrong here?
Comments
Post a Comment