Angularjs 试图测试一个工厂,我有注射问题

Angularjs 试图测试一个工厂,我有注射问题,angularjs,testing,jasmine,karma-jasmine,code-injection,Angularjs,Testing,Jasmine,Karma Jasmine,Code Injection,一般来说,我对测角和测试比较陌生。我正在尝试设置一个基本测试,在开始测试任何其他内容之前,先查看对象是否已定义 我得到这个错误: 错误:[$injector:unpr]未知提供程序:$stateParamsProvider$stateParams是angular ui/ui路由器中的服务。确保karma.conf.js文件中包含ui路由器。找到了解决方案。我需要将这些模块添加到测试文件中: beforeEach(module('omnibyte_inspect_web.objects')); b

一般来说,我对测角和测试比较陌生。我正在尝试设置一个基本测试,在开始测试任何其他内容之前,先查看对象是否已定义

我得到这个错误:


错误:[$injector:unpr]未知提供程序:$stateParamsProvider
$stateParams
是angular ui/ui路由器中的服务。确保karma.conf.js文件中包含ui路由器。

找到了解决方案。我需要将这些模块添加到测试文件中:

beforeEach(module('omnibyte_inspect_web.objects'));
beforeEach(module('ui.router'));
beforeEach(module('ionic'));
在我的karma.conf.js文件中,这被注释掉了:

'www/lib/ionic/js/ionic.bundle.js',

在做了这些更改之后,它被修复了。

这已经包含在karma文件中,我仍然得到错误信息。这是正确的文件吗?”www/lib/ionic/js/angular-ui/angular-ui-router.js'添加了一些编辑,希望这能有所帮助。谢谢你的帮助。谢谢你的帮助!请不要添加“已解决”。接受解决问题的答案,这可能是你的答案。很好,谢谢。干得好!茉莉花注射错误通常会在那里的某个地方发现。很难去调试,谢谢!我感谢你的帮助。
angular.module('omnibyte_inspect_web.objects')
.factory('Form', ['forms_factory', 'authentication_service', 'common_questions_factory', 'formdata_factory', 'missinginformation_factory', '$stateParams', 'Question', 'LocationContact', '$rootScope', '$ionicPopup', '$state',
function (forms_factory, authentication_service, common_questions_factory, formdata_factory, missinginformation_factory, $stateParams, Question, LocationContact, $rootScope, $ionicPopup, $state) {
beforeEach(module('omnibyte_inspect_web.objects'));
beforeEach(module('ui.router'));
beforeEach(module('ionic'));
'www/lib/ionic/js/ionic.bundle.js',