错误:无法在karma的重映射覆盖中找到... ts的源地图

时间:2016-11-10 10:18:06

标签: typescript karma-runner karma-jasmine cobertura source-maps

我正在尝试在jenkins服务器上为typescript angularjs应用程序生成cobertura覆盖率报告。

karma.conf.js

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

files: [
  'app/**/*.ts',
  './build/vendor.js',
  { pattern: './bower_components/angular-resource/angular-resource.js', watch: false },
  { pattern: './bower_components/angular-mocks/angular-mocks.js', watch: false },
  { pattern: 'api/**/*.json', served: true, included: false },
  'build/app.js',
  'test/**/*.test.ts'
],

// Source files that you wanna generate coverage for.
// Do not include tests or libraries
preprocessors: {
  "app/**/*.ts": ["coverage"],
  "**/*.ts": ["karma-typescript"],
  "app/**/*.js": ["sourcemap"]
},

// browsers to test against, be sure to install the correct karma browser launcher plugin
browsers: ["Chrome"],

// level of logging: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_WARN,

// base path, that will be used to resolve files and exclude
basePath: '.',

// web server port
port: 7676,

// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ["jasmine", "karma-typescript"],

// Additional reporters, such as growl, junit, teamcity or coverage
reporters: ["progress", "karma-typescript", "junit", "coverage", "remap-coverage"],

// the default configuration 
junitReporter: {
  outputDir: 'test/results/', // results will be saved as $outputDir/$browserName.xml 
  outputFile: 'unittest.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile 
  suite: '', // suite will become the package name attribute in xml testsuite element 
  useBrowserName: true, // add browser name to report and classes names 
  nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element 
  classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element 
  properties: {} // key value pair of properties to add to the <properties> section of the report 
},

coverageReporter: {
  type: 'in-memory'
},

remapCoverageReporter: {
  cobertura: './coverage/cobertura.xml',
},

plugins: [
  'karma-jasmine',
  'karma-phantomjs-launcher',
  'karma-chrome-launcher',
  'karma-typescript',
  'karma-typescript-preprocessor',
  'karma-coverage',
  'karma-junit-reporter',
  'karma-remap-coverage',
  'karma-sourcemap-loader'
],

// Continuous Integration mode, if true, it capture browsers, run tests and exit
singleRun: true,

// Set this for CI, encase its slow (SauceLabs)
// captureTimeout: 120000,

// enable / disable watching file and executing tests whenever any file changes
// autoWatch: true, // (set it grunt file)

// Enable or disable colors in the output (reporters and logs).
colors: true
});
};

每次我运行测试时都会收到此错误

  

错误:找不到源地图:“C:\ projects ... \ app \ layout \ language \ languages.controller.ts”

缺少什么?一些建议?

0 个答案:

没有答案