문제

Here's my config file:

module.exports = function(config) {
    config.set({
        basePath: './',
        autoWatch: true,
        frameworks: ['jasmine'],
        files: [
            '../public_html/libs/mylib/lib.js',
            '../public_html/libs/mylib/utility.js',
            '../public_html/libs/mylib/config/*.js',
            '../public_html/libs/mylib/enumerations.js',
            '../public_html/libs/mylib/apiComm.js',
            '../public_html/libs/mylib/baseObject.js',
            '../public_html/libs/mylib/book.js',
            '../public_html/libs/mylib/file.js',
            '../public_html/libs/mylib/library.js',
            '../public_html/libs/mylib/publishing.js',
            '../public_html/libs/mylib/topic.js',
            '../test/*Spec.js'
        ],
        reporters: ['progress', 'coverage'],
        preprocessors: {
            '../public_html/libs/mylib/topic.js': ['coverage']
        },
        port: 9876,
        colors: true,
        browsers: ['Chrome'],
        captureTimeout: 60000,
        singleRun: false
    });
};

Whenever I run karma start config/karma.config.js it runs the unit tests and creates the coverage folder in the correct place. However, it dumps the topic.js.html file in the same directory as topic.js. Why?

도움이 되었습니까?

해결책

I know this is late reply, but it might help someone else as well.

Move your config file up one folder and change the "../public_html" to "public_html"

I just got done dealing with this.

Yes you need to have the...

coverageReporter: {
     type : 'html',
     dir : 'coverage/'
}

...as Acosta stated, but your also instructing Istanbul when writing the report files to go up one directory and then into the public_html folder. If the the karma.conf.js file is located in the same folder as the app and test folders then your reports should render in the proper location.

다른 팁

you need to add coverageReporter,

   coverageReporter: {
         type : 'html',
         dir : 'coverage/'
   }

O you also may add a collection of reporters

   coverageReporter: {
        reporters: [
          //{ type: 'html', dir: 'TestOutputFolder/' },
          { type: 'text-summary', dir: 'TestOutputFolder/' },
          { type: 'cobertura', dir: 'TestOutputFolder/' }
        ]
    },
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top