我尝试测试下面的代码:
describe('myService test', function () {
describe('when I call myService.one', function () {
beforeEach(angular.module('TargetMarketServices'));
it('returns 1', inject(function (imagesRepository) {
expect(true).toEqual(true);
}));
});
});
执行此代码时,我收到此错误:
TypeError: 'undefined' is not a function (evaluating 'this.func.apply(this.spec)')
at http://localhost:8080/testacular.js:76
at http://localhost:8080/context.html:35
ReferenceError: Can't find variable: inject
at /home/peter/Dropbox/AngularJS/set-component/test/sets/sets-ihm.js:6
at /home/peter/Dropbox/AngularJS/set-component/test/sets/sets-ihm.js:8
at /home/peter/Dropbox/AngularJS/set-component/test/sets/sets-ihm.js:10
PhantomJS 1.8:执行 1 of 3(1 FAILED)(跳过 2)(0.072 秒 / 0.01 秒)
对于我的测试,我将 Testacular 与 Jasmine 和 PhantomJS 一起使用。