小编Met*_*bda的帖子

Karma测试似乎没有加载我的Angularjs控制器

我用karma运行我的角度测试,我的应用程序在浏览器中正常运行,但测试失败,我怀疑设置错误.

以下是控制器和测试:

// app/scripts/controllers/main.js

'use strict';

angular.module('GloubiBoulgaClientApp')
  .controller('MainCtrl', function ($scope) {

  }); 
Run Code Online (Sandbox Code Playgroud)

这是测试文件:

'use strict';

describe('Controller: MainCtrl', function () {

  // load the controller's module
  beforeEach(module('GloubiBoulgaClientApp'));

  var MainCtrl,
    scope;  

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    MainCtrl = $controller('MainCtrl', {
      $scope: scope
    });
  }));  

  it('should attach a list of awesomeThings to the scope', function () {
    expect(true).toBe(true);
  });
});
Run Code Online (Sandbox Code Playgroud)

因果报应

module.exports = function(config) {
  config.set({
    // base path, that will be used …
Run Code Online (Sandbox Code Playgroud)

testing controller angularjs karma-runner

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

angularjs ×1

controller ×1

karma-runner ×1

testing ×1