我试图通过Karma用Jasmine测试我的AngularJS应用程序.我收到此错误(至少,这是最新的错误):
Uncaught TypeError: Cannot read property '$modules' of null
at /Users/benturner/Dropbox/Code/galapagus/app/static/js/angular-mocks.js:1866
Run Code Online (Sandbox Code Playgroud)
来自我的karma.conf.js:
files: [
'static/js/jquery.min.js',
'static/js/angular.min.js',
'static/js/angular-mocks.js',
'static/js/angular-resource.min.js',
'static/js/angular-scenario.js',
'static/js/angular-loader.min.js',
'static/js/momentous/ctrl_main.js', // contains all my app's code
'test/momentous.js'
],
Run Code Online (Sandbox Code Playgroud)
这是我的测试:
(function () {
"use strict";
var controller = null;
var scope = null;
describe("Services", inject(function($rootScope, Moments) {
var mockedFactory, moments, flag, spy;
moments = [{name: 'test'}];
beforeEach(module('momentous', function($provide) {
scope = $rootScope.$new();
$provide.value('$rootScope', scope);
mockedFactory = {
getList: function() {
return moments;
}
};
spy = jasmine.createSpy(mockedFactory.getList);
$provide.value('Moments', mockedFactory);
})); …Run Code Online (Sandbox Code Playgroud) 我正在将我的python脚本从使用pymongo切换到使用mongoengine.以前,我有这个电话:
client_count = db.command("serverStatus")["connections"]['current'] - 1
但我希望使用mongoengine的包装来获取当前连接的数量.我查看了服务器状态和mongoengine 文档,但无法找到提取服务器变量的等效调用.
我想交换到mongoengine,因为我们正在使用其ODM功能,我们希望减少冗余.
有什么指针吗?什么是正确的语法,如果有的话?谢谢.
与此同时,我们将使用pymongo获取正确的数据,同时使用mongoengine获取其他所有数据.
angularjs ×1
jasmine ×1
javascript ×1
karma-runner ×1
mongodb ×1
mongoengine ×1
python ×1
unit-testing ×1