-
Notifications
You must be signed in to change notification settings - Fork 248
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
Coverage Report Dumps .js.html files into same directory as covered files when karma conf file in separate directory #65
Coverage Report Dumps .js.html files into same directory as covered files when karma conf file in separate directory #65
Comments
You have the ability to customise the way the coverage works by adding the Have you tried something like this? coverageReporter : {
type : 'html',
dir : 'coverage/'
} |
I did use the module.exports = function(config) {
config.set({
basePath: '../public_html/libs/mylib/',
autoWatch: true,
frameworks: ['jasmine'],
files: [
'../jquery/*.js',
'mylib.js',
'utility.js',
'config/*.js',
'enumerations.js',
'apiComm.js',
'baseObject.js',
'book.js',
'file.js',
'library.js',
'publishing.js',
'topic.js',
'thirdPartyApi.js',
'../../../test/sharedSpec.js',
'../../../test/*Spec.js'
],
reporters: ['progress', 'coverage'],
preprocessors: {
'mylib.js': ['coverage'],
'utility.js': ['coverage'],
'enumerations.js': ['coverage'],
'apiComm.js': ['coverage'],
'baseObject.js': ['coverage'],
'book.js': ['coverage'],
'file.js': ['coverage'],
'library.js': ['coverage'],
'publishing.js': ['coverage'],
'topic.js': ['coverage'],
'thirdPartyApi.js': ['coverage']
},
coverageReporter: {
type : 'html',
dir : '../../../coverage/'
},
port: 9876,
colors: true,
browsers: ['Chrome'],
captureTimeout: 60000,
singleRun: false
});
}; |
Thanks opnsrce for that work around but this it is a bug so I think it is better to be fixed |
@opnsrce are you running on windows? I'm having the same issue too, just checking to see if it's platform dependent |
Just to add a little bit to help with this issue - I was able to solve this issue by making sure that none of the files listed start with |
I run on windows and saw the same behavior. I modified my karma config file so the base path was the root of my src, lib, and tests sibling directories, and that solved the problem. config.set({
basePath: '../',
frameworks: ['jasmine'],
plugins: [
'karma-jasmine',
'karma-coverage',
'karma-chrome-launcher',
'karma-phantomjs-launcher'
],
preprocessors: {
'src/**/*.js': ['coverage']
},
files: [
'lib/jquery/dist/jquery.js',
'lib/angular/angular.js',
'lib/angular-mocks/angular-mocks.js',
'src/app.js',
'src/templates.js',
'src/**/*.js',
'tests/*.js',
'tests/**/*.js'
],
exclude: [
'tests/manual/*.*'
],
reporters: ['dots', 'coverage'],
coverageReporter: {
reporters: [
{ type: 'lcov', dir: 'tests/coverage/' },
{ type: 'cobertura', dir: 'tests/coverage/' }
]
},
and so on... |
Solved exactly as finleysg : by setting a basePath value (!= '').. |
I was having the same behaviour. The problem is not related strictly to basepath, but any path should start with '../' as suggested by @dwmkerr |
confirmed also, same problem, |
This is not a bug, but rather how karmas |
@dignifiedquire are you sure? It looks like a bug or at the very least unexpected behaviour.. Setting a particular type of basepath on windows causes coverage to ignore a particular option.. Where is that documented? Or is it a bug in karma? If so do you have a link? |
Sorry, looks like it's not as simple as that.. |
+1 for this problem. Really glad I found this issue describing work-arounds. |
Same issue for me on windows. The coverage reports are not generated in the configured folder. var istanbul = require('browserify-istanbul');
module.exports = function(config) {
config.set({
basePath: '../../../',
frameworks: ['browserify', 'mocha', 'sinon-chai'],
preprocessors: { 'src/main/web/js/**/*.js': ['browserify', 'coverage'] },
browsers: ['Chrome'],
reporters: ['progress', 'coverage'],
autoWatch: true,
browserify: {
debug: true,
transform: [
istanbul({ ignore: ['**/node_modules/**', '**/test/**'] })
]
},
coverageReporter: {
dir : 'build/reports/web/unit/'
},
files: [
'node_modules/angular/angular.min.js',
'node_modules/angular-mocks/angular-mocks.js',
'src/main/web/js/main.js',
'src/test/web/unit/**/*.js'
]
});
}; But as soon as is remove the coverage from the preprocessor it works. All files will be generated in the specified folder. This means preprocessors: { 'src/main/web/js/**/*.js': ['browserify'] }, |
+1 Same issue here on windows using |
I am facing the same problem, in my case Absolute path is used as base path. Following is my config file Karma modules and its configuration file are in a different folder structure, maintained common for different projects (c:/dev/tools/karma). Each project will have individual karma config. |
👍 we're seeing this issue as well on Windows 7. This wasn't happening a couple weeks ago with We'll stick with Thank you. |
Confirm that |
Same problem here on Windows 8, with 0.5.0 |
I also started having this problem with 0.5.0 (27e0b09). Was using 0.4.2 before. |
+1 backed down from 0.5.x to 0.4.2 Problems go away! |
- yllr.check() 'condition' parameter can now be a function - add a few more unit tests - updated a few devDependencies, but kept karma-coverage at ^0.4.2' because of [1] [1] karma-runner/karma-coverage#65
Diff 0.5.x and 0.4.2 |
Uninstall 0.5.x and installed 0.4.2 |
+1, does anybody started out planning to fix it? |
Looking at the diff it looks to me like the modifications to |
I can verify that reverting to 0.4.2 fixes the issue. |
Thank you, that does we already know. The problem is that a newer version is not working properly. We need a better documentation or a fix. |
Definitely it's a bug, it should resolve paths as all modular systems do. |
Reverting to 0.4.2 fixes issue 👍 |
Should be fixed in |
Still not working on 0.5.1 and 0.5.3 |
@GBreeze please file a new issues with repro |
For me this was fixed after all to make small change in the istanbul html reporter (lib/report/html.js). My fork is here not sure if it is universal fix. Worked for me. |
I was able to fix this by updating the basepath to use its real path vs the symlink. Ex: the former returned something like 'K:' vs the real path 'C:\dev'. It seems that when the other files are pulled in its real path is used. So when istanbul attempts to resolve 'K:\FOLDER_FOR_COVERAGE' & 'C:\dev\FILE_BEING_COVERED' nothing overlaps so it uses 'C:\dev'. the goal is to have the absolute path to the coverage as 'C:\dev\FOLDER_FOR_COVERAGE' vs 'K:\FOLDER_FOR_COVERAGE'. Hope this help! FYI I'm using Node 6.1.0 - Karma 1.1.2 - Karma Coverage 1.1.1 - Istanbul 0.4.4 on Windows 7 |
I've noticed the following possible bug:
When the karma conf file is in a separate directory from the files being tested, the coverage report files don't get placed in the
coverage
directory. Instead, the files get placed in the same directory as the files being covered.Here's my karma conf file for reference:
The text was updated successfully, but these errors were encountered: