Reputation: 3294
I have meteor app and want to test some angular controllers. So in package.js
Package.onTest(function(api) {
var CLIENT = 'client',
SERVER = 'server',
BOTH = [CLIENT, SERVER];
api.use('sanjo:[email protected]', BOTH);
api.use('angular', BOTH);
api.use('angular:[email protected]', BOTH);
api.use('mdg:[email protected]', 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);
});
and in test file
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();
});
});
...
});
When i run VELOCITY_TEST_PACKAGES=1 meteor test-packages --driver-package velocity:html-reporter ./
it gives me an error ReferenceError: angular is not defined
(in browser). So the question is how to use angular and other modules defined in onTest
function in this test?
packages
file:
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
Upvotes: 0
Views: 264