如何让业力报道与Aurelia和打字稿一起使用?

时间:2017-03-09 13:43:01

标签: javascript typescript karma-runner aurelia karma-coverage

我们的网站正在使用Aurelia导航骨架 - 打字机入门套件。我能够使用茉莉和业力进行单元测试,但我无法获得业力报道。有没有办法让这个工作?

我试图通过以下karma.conf.js文件将其用于skeleton-typescript项目。

module.exports = function(config) {
  config.set({
    basePath: './',
    frameworks: ['systemjs', 'jasmine'],
    systemjs: {
      configFile: 'config.js',
      config: {
        paths: {
          "*": "*",
          "src/*": "src/*",
          "typescript": "node_modules/typescript/lib/typescript.js",
          "systemjs": "node_modules/systemjs/dist/system.js",
          'system-polyfills': 'node_modules/systemjs/dist/system-polyfills.js',
          'es6-module-loader': 'node_modules/es6-module-loader/dist/es6-module-loader.js'
        },
        packages: {
          'test/unit': {
            defaultExtension: 'ts'
          },
          'src': {
            defaultExtension: 'ts'
          }
        },
        transpiler: 'typescript',
        typescriptOptions : {
          "module": "amd",
          "emitDecoratorMetadata": true,
          "experimentalDecorators": true
        }
      },
      serveFiles: [
        'src/**/*.*',
        'jspm_packages/**/*.js'
      ]
    },
    files: [
      'test/unit/setup.ts',
      'test/unit/*.ts'
    ],
    exclude: [],
    preprocessors: { 'src/**/*.ts': ['coverage']},
    reporters: ['progress', 'coverage'],
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};

1 个答案:

答案 0 :(得分:0)

我建议使用cli并使用au new。此模板自去年以来已更新,并提供了选项。您可以默认设置Karma。