angularjs - 如何配置 karma-runner(也称为 testacular)以使用closure-library

标签 angularjs mocha.js google-closure google-closure-library karma-runner

我正在尝试将 karma-runner 与 mocha 测试框架一起使用来测试使用closure-library 和 angularjs 构建的应用程序。

我总是收到 namespace.Application is not defined
提前致谢。

这是我的配置文件

basePath = '';

files = [
  MOCHA,
  MOCHA_ADAPTER,
  {pattern: 'vendors/closure-library/closure/goog/base.js', watched: false, included: true, served: true},
  {pattern: 'public/javascripts/deps.js', watched: true, included: true, served: true},
  {pattern: 'node_modules/expect.js/expect.js', watched: false, included: true, served: true},
  {pattern: 'public/javascripts/*.js', watched: true, included: false, served: true},
  {pattern: 'tests/*.test.js', watched: true, included: true, served: true}
];
exclude = [
];
reporters = ['progress'];
port = 9876;
runnerPort = 9100;
colors = true;
logLevel = LOG_INFO;
autoWatch = true;
browsers = ['Chrome', 'Firefox'];
captureTimeout = 60000;
singleRun = false;

这是一个简单的测试文件
goog.require('namespace.Application');

describe('some sample', function() {
    it('should do something', function(done){
        console.log('asdasd', reAdoptAHydrant);
        done();
    });
});

最佳答案

我找到了这个 repo有一些关于使用 karma testrunner 设置 Google 关闭的提示。

关于angularjs - 如何配置 karma-runner(也称为 testacular)以使用closure-library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16531590/

相关文章:

javascript - 是否有可能为 `goog.debug.Logger` 获得更好的输出(如 `console.log` )?

javascript - 在 AngularJS 中创建和访问全局常量

asp.net - 在 VS Code 和 VS 2015 之间切换

spring-mvc - 使用 AngularJS 配置 Spring MVC

javascript - 如何在前端显示mongodb的内容?

javascript - Mocha 中的Sinon Stub 不工作

javascript - 使用 Mocha 在 NodeJS 和 MongoDB 中测试用户模型时没有结果

javascript - 谷歌关闭高级 |无法识别对象属性 |动态属性?

javascript - 在测试复制实际对象时注入(inject)全局变量,需要相同的实例

ClojureScript google 闭包代码分割部分加载