-
Notifications
You must be signed in to change notification settings - Fork 50
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
Code coverage with karma-jspm #22
Comments
+1 |
2 similar comments
+1 |
+1 |
+1 |
@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). |
+1 |
+1 I can't get coverage reports working |
+1 getting some feedback on whether this project is still active would be great |
Code coverage using
Where 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 |
It seems like coverage doesn't include transpiler over karma-jspm into my tests execution if I have coverage configuration. I am getting:
Line 1 is starting with 'import'. Here is my karma.config. |
In case it's useful, I was getting the same error. I believe it was due to my /* 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'], |
has anybody got running the coverage? @djindjic I tried run the preprocessor for coverage as you have suggested but all my test are failing |
I just did what @twalker suggested and mine works perfectly. Thanks! |
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) :
Changeset: karma-runner/karma-coverage#131 |
I'm using
karma-coverage
along withkarma-jspm
. Coverage reports are being generated, but only for source files that are referenced in test files. However, any source files that are not required from a test file doesn't show up in the coverage report.Is this is because karma-jspm highjacks the karam
files
config, only including files that are referenced? Any ideas on how to get the coverage reports to list all source files so the reporting is more accurate?Here's relevant portions of my karma config:
I've attempted to include both tests and source files in
jspm.loadFiles
, but it blows up with errors. These are errors I may be able to resolve, but wanted to first find out if there is a better approach I should be taking.The text was updated successfully, but these errors were encountered: