0

我有流星应用程序并想测试一些角度控制器。所以在package.js

Package.onTest(function(api) {
  var CLIENT = 'client',
    SERVER = 'server',
    BOTH = [CLIENT, SERVER];

  api.use('sanjo:jasmine@0.13.6', BOTH);
  api.use('angular', BOTH);
  api.use('angular:angular-mocks@1.4.4', BOTH);
  api.use('mdg:camera@1.1.5', BOTH);

  api.use('underscore', BOTH);
  api.use('session', BOTH);
  api.use('mongo', BOTH);
  api.use('tracker', BOTH);
  api.addFiles([
    'tests/jasmine/server/integration/permission.js'
  ], BOTH);
});

并在测试文件中

describe('пермишны', function () {
  beforeEach(function () {
    angular.mock.module('myapp.myModule');
    angular.mock.inject(function (_$meteorUtils_, _$rootScope_) {
      $meteorUtils = _$meteorUtils_;
      $rootScope = _$rootScope_;
      // Creates a new child scope.
      $scope = $rootScope.$new();
    });
  });
  ...
});

当我运行VELOCITY_TEST_PACKAGES=1 meteor test-packages --driver-package velocity:html-reporter ./它给我一个错误ReferenceError: angular is not defined(在浏览器中)。那么问题是如何onTest在这个测试中使用函数中定义的角度和其他模块?

packages文件:

angularui:angular-ui-router
angular:angular-material
less
ncuillery:angular-breadcrumb
accounts-ui
accounts-base
service-configuration
accounts-google
meteorhacks:ssr
meteorhacks:npm

momentjs:moment


npm-container
liyu:sprintfjs
standard-minifiers
meteor-base
mobile-experience
mongo
blaze-html-templates
session
jquery
tracker
logging
reload
random
ejson
spacebars
check
angular
velocity:html-reporter
velocity:console-reporter
sanjo:jasmine
angular:angular-mocks
4

0 回答 0