Tests in AngularJS: Reference error of the inject function

后端 未结 2 1995
無奈伤痛
無奈伤痛 2021-02-18 23:19

I try to test the code below:

describe(\'myService test\', function () {
    describe(\'when I call myService.one\', function () {
        beforeEach(angular.mod         


        
2条回答
  •  悲哀的现实
    2021-02-19 00:12

    AngularJS provides two testing libraries:

    • angular-mocks.js
    • angular-scenario.js

    angular-mocks is used for Jasmine and Karma testing. It publishes global methods module() and inject() to be used in your Jasmine spec tests. This means you must load the angular-mocks.js script (after you load the angular.js library/script)

    angular-scenario is only used for e2e testing.

提交回复
热议问题