Chrome中的Karma调试不再有效

时间:2017-02-02 16:33:49

标签: karma-runner karma-chrome-launcher

我们正在开发一个Angular项目,我们在测试环境中使用Karma / Jasmine。我们一直在使用karma-chrome-launcher来调试测试,它运行良好。出于某种原因,它最近停止了工作。我无法弄清楚为什么,因为我们没有改变任何有关该管道的事情。我们尝试更新到最新的Karma(1.4.1),但这没有帮助。有没有其他人看到这个问题,并能够解决它?感谢帮助。我已经附加了两张关于Chrome检查器在您第一次打开调试器时的样子,然后设置断点并点击刷新后的图像(它应该与第一张图像看起来相同,但是没有)编辑底部的karma.config

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 个答案:

没有答案