ReferenceError:inject没有定义jasmine

时间:2018-01-17 12:26:28

标签: angularjs typescript jasmine

注射的问题

            beforeEach(() => {
                angular.module('app.people', []);
                inject(($injector: ng.auto.IInjectorService) => {
                    $controller = $injector.get<ng.IControllerService>('$controller');
                    $rootScope = $injector.get<ng.IRootScopeService>('$rootScope');
                    massterControllerParams = {
                        $rootScope: $rootScope,
                        eventNames: vdog.eventNames
                    };
                });
                sut = $controller<vdog.MasterController>('masterController', massterControllerParams);
            });

ReferenceError: inject is not defined
at UserContext.<anonymous> (file:///C:/dev/VirtualDog/VirtualDog/test/spec/masterControllerSpec.js:8:13)
at attempt (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4289:46)
at QueueRunner.run (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4217:20)
at QueueRunner.execute (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4199:10)
at Spec.queueRunnerFactory (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:909:35)
at Spec.execute (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:526:10)
at UserContext.fn (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5340:37)
at attempt (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4297:26)
at QueueRunner.run (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4217:20)
at QueueRunner.execute (file:///C:/dev/VirtualDog/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4199:10)

SpecRunner.html

  <link rel="shortcut icon" type="image/png" href="../../node_modules/jasmine-core/images/jasmine_favicon.png">
  <link rel="stylesheet" href="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">

  <!-- include jasmine libs here -->
  <script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
  <script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
  <script src="../../node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>

  <!-- include bower and node_mobules here... -->
  <script src="../bower_components/angular/angular.js"></script>
  <script src="../bower_components/angular-route/angular-route.js"></script>
  <script src="../../node_modules/angular-mocks/angular-mocks.js"></script>

我用茉莉和打字稿写了单元测试 我无法运行测试,因为注入 请帮忙

0 个答案:

没有答案