【问题标题】:Trying to get Karma tests up with EmberJS using RequireJS尝试使用 RequireJS 使用 EmberJS 进行 Karma 测试
【发布时间】:2014-03-11 07:49:13
【问题描述】:

我正在尝试使用http://karma-runner.github.io/0.8/plus/RequireJS.html 来启动和运行我的测试。我的karma.conf.js 文件是:

// 业力配置 // 生成于 2014 年 2 月 12 日星期三 13:35:05 GMT-0500 (EST)

module.exports = function(config) {
  config.set({
    basePath: 'scripts',
    frameworks: ['qunit', 'requirejs'],
    files: [
      '../tests/test-bootstrap.js',
      {pattern: '../tests/**/*Spec.js', included: false}
    ],
    exclude: [

    ],
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: false,
    browsers: ['PhantomJS'],
    captureTimeout: 60000,
    singleRun: true
  });
};

我的test-bootstrap.js 文件是:

tests = [];

for (file in window.__karma__.files) {
  if (window.__karma__.files.hasOwnProperty(file)) {
    if (/Spec\.js$/.test(file)) {
      tests.push(file);
    }
  }
}

console.log(tests);

requirejs.config({
  baseUrl: "scripts",
  paths: {
    jquery: "../lib/jquery",
    underscore: "../lib/underscore"
  },
  shim: {
    underscore: {
      exports: "_"
    }
  },
  deps: tests,
  callback: window.__karma__.start
});

我怎样才能让它允许 CoffeeScript 文件?

【问题讨论】:

    标签: javascript ember.js coffeescript karma-runner


    【解决方案1】:

    您可能需要预编译您的咖啡脚本文件。看看https://github.com/karma-runner/karma-coffee-preprocessor

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-25
    • 2013-05-16
    • 2016-04-14
    • 2019-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多