Comments (14)
+1
from karma-jspm.
+1
from karma-jspm.
+1
from karma-jspm.
+1
from karma-jspm.
@tauren I can't get coverage reports working at all when trying to use on-the-fly transpilation (which is what karma-jspm is doing here I guess). I see a lot of other examples where coverage runs against already transpiled sources though (where transpiling happens during karma-preprocessing).
I thought it might be helpful to see your complete karma config in case I'm missing something here (like maybe you are using Chrome instead of PhantomJS or something like that).
from karma-jspm.
+1
from karma-jspm.
+1 I can't get coverage reports working
from karma-jspm.
+1 getting some feedback on whether this project is still active would be great
from karma-jspm.
Code coverage using karma-coverage
should work as expected. Be sure to include the preprocessor configuration in karma.conf.js
:
preprocessors = {
'build/src/**/*.js': ['coverage']
};
reporters = ['progress', 'coverage'];
Where build/src/
is the location from where your source files are being required/loaded.
The original issue that @tauren is indeed a valid issue, though. If the test runner does not end up loading some of your source, it will not be included in the coverage report. If this is a problem for you I would suggest trying to put all source and test files in jspm.loadFiles
... and if that doesn't work for you I'd create a dummy test file that simply requires all the source files that you want to test.
from karma-jspm.
It seems like coverage doesn't include transpiler over karma-jspm into my tests execution if I have coverage configuration. I am getting:
ERROR [preprocessor.coverage]: Line 1: Unexpected reserved word
Line 1 is starting with 'import'. Here is my karma.config.
Could you guys please take a look @maxwellpeterson-wf @tauren?
from karma-jspm.
In case it's useful, I was getting the same error. I believe it was due to my serveFiles
files not being transpiled.
As a workaround, I added the karma-babel-preprocessor to transpile before coverage:
/* related karma.conf.js fragment */
frameworks: ['jspm', 'jasmine'],
jspm: {
loadFiles: ['app/**/*spec.js'],
serveFiles: ['app/**/*.js', 'app/**/*.html']
},
files: [/* defers to async loading by jspm framework */],
preprocessors: {
'app/**/!(*spec).js': ['babel', 'coverage'],
},
// transpile with babel since the coverage reporter throws error on ES6 syntax
babelPreprocessor: {
options: {
modules: 'system'
}
},
reporters: ['progress', 'coverage'],
from karma-jspm.
has anybody got running the coverage? @djindjic I tried run the preprocessor for coverage as you have suggested but all my test are failing
from karma-jspm.
I just did what @twalker suggested and mine works perfectly. Thanks!
from karma-jspm.
In case anyone ends up here wondering how to include all source files (@tauren's original question), karma-coverage added this parameter recently (last few months) :
coverageReporter: {
type : 'html',
dir : 'coverage/',
includeAllSources : true // <-- This aptly named param brings in all sources.
},
Changeset: karma-runner/karma-coverage#131
from karma-jspm.
Related Issues (20)
- The jasmine tests do not make the travis build fail
- 404 when using import HOT 8
- karma.error is not a function HOT 3
- Two more possible config files (jspm 0.17-beta.17) HOT 1
- Cannot start karma HOT 1
- karma v1.0.0: You need to include some adapter that implements __karma__.start method! HOT 22
- New test files not being run
- Add custom adapter option HOT 1
- Update "glob" dependency to 6 to get rid of negate behavior
- Only loading one test file
- SystemJS was not found HOT 3
- 404 when running tests on PhantomJS HOT 3
- 404: /base/jspm_packages/npm/@angular/[email protected]/testing.js HOT 8
- File not found (404) with the 0.17 beta 29 of JSPM HOT 2
- Only loading a subset of files HOT 2
- How to add System into Karma HOT 8
- karma tests returning 404
- Add support for SystemJS map configuration
- Console warning not necessary HOT 1
- 404 Error HOT 5
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 karma-jspm.