Karma debugging in Chrome no longer working

764 views Asked by At

We are working on an Angular project where we are using Karma/Jasmine for our testing environment. We've been using the karma-chrome-launcher for debugging the tests and it was working great. For some reason, it has stopped working lately. I can't figure out why though, as we haven't changed anything regarding that pipeline. We tried updating to latest Karma (1.4.1), but that didn't help. Has anyone else seen this issue and been able to fix it? Help is appreciated. I've attached two images of what the Chrome inspector looks like when you first open the debugger and then after setting a breakpoint and hitting Refresh (it should look the same as the 1st image, but doesn't) edit: karma.config at bottom as well

enter image description here

enter image description here

'use strict';

var path = require('path');
var conf = require('./gulp/conf');

var _ = require('lodash');
var wiredep = require('wiredep');

var pathSrcHtml = [
 path.join(conf.paths.src, '/**/*.html')
];

function listFiles() {
  var wiredepOptions = _.extend({}, conf.wiredep, {
   dependencies: true,
   devDependencies: true
  });

  var patterns = wiredep(wiredepOptions).js
   .concat([
    path.join(conf.paths.src, '/app/**/*.module.js'),
    path.join(conf.paths.src, '/app/**/*.js')
   ])
   .concat(pathSrcHtml)
   .concat('karmaMobileFramework/*.js');

   var files = patterns.map(function(pattern) {
    return {
     pattern: pattern
    };
   });
   files.push({
    pattern: path.join(conf.paths.src, '/assets/**/*'),
    included: false,
    served: true,
    watched: false
   });
 return files;
}

module.exports = function(config) {

var configuration = {

files: listFiles(),

singleRun: false,

autoWatch: true,

preprocessors : {
  '/**/*.html': ['ng-html2js']
},

ngHtml2JsPreprocessor: {
  stripPrefix: conf.paths.src + '/',
  moduleName: 'directive-templates'
},

logLevel: 'WARN',

frameworks: ['jasmine', 'jasmine-matchers', 'angular-filesort'],

angularFilesort: {
  whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')]
},

browsers : ['Chrome'],

plugins : [
  'karma-chrome-launcher',
  'karma-angular-filesort',
  'karma-coverage',
  'karma-jasmine',
  'karma-jasmine-matchers',
  'karma-ng-html2js-preprocessor',
  'karma-htmlfile-reporter',
  'karma-junit-reporter'
],

coverageReporter: {
  type : 'html',
  dir : 'reports/coverage/',
  reporters: [
    { type: 'html', subdir: 'report-html' },
    { type: 'cobertura', subdir: 'report-jenkins' }
  ]
},

reporters: ['progress', 'html', 'junit'],

junitReporter: {
  outputDir: 'reports/tests/',
  outputFile: 'test-results.xml',
  useBrowserName: false
},

htmlReporter: {
  outputFile: 'reports/tests/results.html',
  pageTitle: 'BOLT Unit Tests'
},

 proxies: {
  '/assets/': path.join('/base/', conf.paths.src, '/assets/')
 }
};

 // This is the default preprocessors configuration for a usage with Karma cli
 // The coverage preprocessor is added in gulp/unit-test.js only for single tests
 // It was not possible to do it there because karma doesn't let us now if we are
 // running a single test or not
 configuration.preprocessors = {};
 pathSrcHtml.forEach(function(path) {
  configuration.preprocessors[path] = ['ng-html2js'];
 });

 config.set(configuration);
 };
0

There are 0 answers