2

Here are the facts:

  • I have a nodejs app
  • I've written some Jasmine tests
  • I'm using karma to generate the code coverage report

Here is the karma.conf.js:

module.exports = function (config) {
  config.set({
    frameworks: ['jasmine', 'browserify'],
    files: [
      'utils/dates.js',
      'utils/maths.js',
      'spec/server_utils_spec.js'
    ],
    preprocessors: {
      'utils/*.js': ['coverage', 'browserify'],
      'spec/server_utils_spec.js': ['coverage', 'browserify']
    },
    reporters: ['progress', 'coverage'],
    coverageReporter: {
      type: 'html',
      dir: 'coverage/'
    },
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    singleRun: false
  })
}

These are my packages (I know they are global):

→ npm -g list | grep -i "karma"
├─┬ karma@2.0.4
├─┬ karma-browserify@5.3.0
├─┬ karma-coverage@1.1.2
├─┬ karma-html-reporter@0.2.7
├── karma-jasmine@1.1.2
├─┬ karma-mocha@1.3.0

and despite the terminal log

/usr/bin/karma start server/karma.conf.js
23 07 2018 15:39:36.033:INFO [framework.browserify]: registering rebuild (autoWatch=true)
23 07 2018 15:39:36.817:INFO [framework.browserify]: 3073 bytes written (0.03 seconds)
23 07 2018 15:39:36.817:INFO [framework.browserify]: bundle built
23 07 2018 15:39:36.818:WARN [karma]: No captured browser, open http://localhost:9876/
23 07 2018 15:39:36.822:INFO [karma]: Karma v2.0.4 server started at http://0.0.0.0:9876/
23 07 2018 15:39:39.135:INFO [Chrome 67.0.3396 (Linux 0.0.0)]: Connected on socket H9J96y-fFn-7PfkHAAAA with id manual-9692
Chrome 67.0.3396 (Linux 0.0.0): Executed 0 of 2 SUCCESS (0 secs / 0 secs)
Chrome 67.0.3396 (Linux 0.0.0): Executed 1 of 2 SUCCESS (0 secs / 0.001 secs)
Chrome 67.0.3396 (Linux 0.0.0): Executed 2 of 2 SUCCESS (0 secs / 0.002 secs)
Chrome 67.0.3396 (Linux 0.0.0): Executed 2 of 2 SUCCESS (0.033 secs / 0.002 secs)
TOTAL: 2 SUCCESS

I get this result when I open the generated html report:

enter image description here

I've tried the solutions to all the other related questions and I've come up with nothing. My questions:

  • why the empty report?
  • how can I manage to have the report

Thank you in advance!

sirfoga
  • 121
  • 4

0 Answers0