【问题标题】:Chutzpah unable to find imported angular library moduleChutzpah 找不到导入的角度库模块
【发布时间】:2018-01-24 00:02:33
【问题描述】:

我最近将这个 Angular 库带到了我的项目中:

https://github.com/a5hik/angular-multi-select-tree

除了我的单元测试之外,一切都很好。运行测试时出现此错误:

Module 'multi-select-tree' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

这让我很困惑,因为我已将它添加到我的 chutzpah.json 引用中(并多次确认路径是正确的),如下所示:

{ "Path": "../Scripts/Lib/ng-multi-select-tree/ng-multi-select-tree.js" },
{ "Path": "../Scripts/Lib/ng-multi-select-tree/ng-multi-select-tree.tpl.js" },

并将其包含在我的主 app.js 文件中。注释掉的代码允许 Chutzpah 找到该库,但这会破坏它的所有功能:

// work around for Chutzpah test discovery
//angular.module('multi-select-tree', []);
var authoring = angular.module('authoring', ['ms-content', 'portalCommon', 'ngFileUpload', 'ckeditor', 'ui.bootstrap', 'AdalAngular', 'ui.sortable', 'nvd3', 'multi-select-tree']).run(['$rootScope', function ($rootScope) {}]);

我注意到的是这个库是如何像这样实例化模块的:

(function () {
    'use strict';
    var mainModule = angular.module('multi-select-tree');

他们似乎实例化了模块,然后将其设置为变量。我的同事暗示这可能是问题所在。关于为什么 Chutzpah 很难找到这个特定模块的任何想法?

【问题讨论】:

    标签: javascript angularjs chutzpah


    【解决方案1】:

    这最终与我的模块的初始化方式无关。事实证明 Chutzpah 确实喜欢 lambdas ('=>')。

    【讨论】:

      猜你喜欢
      • 2022-01-07
      • 2022-01-21
      • 1970-01-01
      • 2017-10-13
      • 2018-08-26
      • 1970-01-01
      • 2017-08-09
      • 2017-03-31
      • 1970-01-01
      相关资源
      最近更新 更多