How to configure karma-runner (also known as testacular) to work with closure-library

房东的猫 提交于 2019-12-06 05:57:40

问题


I'm trying to use karma-runner with mocha testing framework to test an application built with closure-library and angularjs.

I always get namespace.Application is not defined

thanks in advance.

here's my config file

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;

and here's a simple test file

goog.require('namespace.Application');

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

回答1:


I found this repo has some pointers in setting up Google closure with karma testrunner.



来源:https://stackoverflow.com/questions/16531590/how-to-configure-karma-runner-also-known-as-testacular-to-work-with-closure-li

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!