karma-runner / karma-coverage

A Karma plugin. Generate code coverage.
MIT License
770 stars 247 forks source link

Can't see the content of files parsed by browserify in coverage report #338

Open viniciusvolpesousa opened 7 years ago

viniciusvolpesousa commented 7 years ago

When I run my tests, I can't see the content of files parsed by browserify:

Content showed in Coverage report:

1 | 1× | typeof require === "function" && require("/home/aurum/projects/astreav2/src/main/angular/components/movements/movementsList/movementsList.controller.js");

My karma.conf.js:

` module.exports = function(config) { config.set({

basePath: './',
frameworks: ['browserify', 'jasmine'],

files: [
  './bower_components/angular/angular.js',
  './bower_components/angular-mocks/angular-mocks.js',
  './bower_components/jquery/dist/jquery.js',
  './bower_components/jquery-ui/jquery-ui.js',
  './bower_components/qtip2/jquery.qtip.js',
  './bower_components/jcrop/js/jquery.color.js',
  './bower_components/jcrop/js/jquery.Jcrop.js',
  './bower_components/ScrollToFixed/jquery-scrolltofixed.js',
  './bower_components/jquery-autosize/dist/autosize.js',
  './bower_components/angular-cookies/angular-cookies.js',
  './bower_components/angular-route/angular-route.js',
  './bower_components/angular-ui-router/release/angular-ui-router.js',
  './bower_components/angular-translate/angular-translate.js',
  './bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js',
  './bower_components/angular-translate-storage-cookie/angular-translate-storage-cookie.js',
  './bower_components/angular-translate-storage-local/angular-translate-storage-local.js',
  './bower_components/angular-dynamic-locale/dist/tmhDynamicLocale.js',
  './bower_components/moment/moment.js',
  './bower_components/moment-business/dist/moment-business.js',
  './bower_components/angular-moment/angular-moment.js',
  './bower_components/moment-timezone/builds/moment-timezone-with-data.js',
  './bower_components/ng-file-upload/angular-file-upload.js',
  './bower_components/ng-file-upload/angular-file-upload-shim.js',
  './bower_components/angular-once/once.js',
  './bower_components/angular-bootstrap/ui-bootstrap.js',
  './bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
  './bower_components/angular-dragdrop/src/angular-dragdrop.js',
  './bower_components/fullcalendar/dist/fullcalendar.js',
  './bower_components/angular-ui-calendar/src/calendar.js',
  './bower_components/textAngular/dist/textAngular-rangy.min.js',
  './bower_components/textAngular/dist/textAngular.min.js',
  './bower_components/spectrum/spectrum.js',
  './bower_components/angular-inview/angular-inview.js',
  './bower_components/angular-credit-cards/release/angular-credit-cards.js',
  './bower_components/file-saver/FileSaver.js',
  './bower_components/js-xlsx/dist/xlsx.core.min.js',
  './bower_components/lodash/dist/lodash.underscore.js',
  './bower_components/ar-dropdown-multiselect/js/ar-dropdown-multiselect.js',
  './bower_components/aurum-select/dist/aurum-select.min.js',
  './bower_components/ngprogress/build/ngprogress.js',
  './bower_components/ngMask/dist/ngMask.js',
  './bower_components/angular-resource/angular-resource.js',
  './node_modules/react/dist/react.min.js',
  './node_modules/jasmine-jquery/lib/jasmine-jquery.js',
  './node_modules/react-dom/dist/react-dom.min.js',
  './node_modules/ngreact/ngReact.js',
  './node_modules/ngclipboard/dist/ngclipboard.min.js',
  './src/main/vendor/sortable.js',
  './src/main/assets/js/frontend.js',
  './src/main/assets/js/astrea-textAngular-sanitize.js',
  './src/main/assets/js/kissmetrics.js',
  './src/main/assets/js/control.js',
  './src/main/angular/utils/**/*.js',
  './src/main/angular/controllers/main/main.js',
  './src/main/angular/services/**/*.js',
  './src/main/angular/components/**/*.js',
  './src/main/angular/directives/**/*.js',
  './src/main/angular/interceptors/**/*.js',
  './src/main/angular/controllers/components/**/*.js',
  './src/main/angular/controllers/main/activitytemplate/**/*.js',
  './src/main/angular/controllers/main/admin/**/*.js',
  './src/main/angular/controllers/main/alerts/**/*.js',
  './src/main/angular/controllers/main/billing/**/*.js',
  './src/main/angular/controllers/main/calendarNew/**/*.js',
  './src/main/angular/controllers/main/contacts/**/*.js',
  './src/main/angular/controllers/main/deadline/**/*.js',
  './src/main/angular/controllers/main/hearing/**/*.js',
  './src/main/angular/controllers/main/documents/**/*.js',
  './src/main/angular/controllers/main/financial/**/*.js',
  './src/main/angular/controllers/main/folders/**/*.js',
  './src/main/angular/controllers/main/notification/**/*.js',
  './src/main/angular/controllers/main/planNew/**/*.js',
  './src/main/angular/controllers/main/search/**/*.js',
  './src/main/angular/controllers/main/tags/**/*.js',
  './src/main/angular/controllers/main/support/**/*.js',
  './src/main/angular/controllers/main/user/**/*.js',
  './src/main/angular/controllers/main/workspace/**/*.js',
  './src/main/angular/controllers/modals/**/*.js',
  './src/main/angular/controllers/public/**/*.js',
  './src/main/angular/controllers/viewer/**/*.js',
  './src/main/angular/controllers/widgets/**/*.js',
  './src/main/angular/controllers/exports/**/*.js',
  './src/main/angular/controllers/reports/**/*.js',
  './src/main/assets/languages/**/*.js',
  'http://apis.google.com/js/client.js',
  './src/test/js/**/*.spec.js'
],

exclude: [
],

preprocessors: {
  'src/main/angular/**/*.js': ['coverage'],
  './src/main/angular/components/**/*.js': 'browserify'
},

    browserify: {
        debug: true,
        transform: [
            ['babelify', {presets: ["es2015"], plugins: ['transform-html-import-to-string']}]
        ]
},

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

reporters: ['progress', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity

}) }`

Note: Only the files in the folder 'src/main/angular/components' are using es6, and this files have the problem. Any idea how to solve this?

enmanuelduran commented 6 years ago

having the same issue, were you able to solve it?