Search code examples
angularjsjasminejshintangular-mock

JSHint and angular-mocks error


When i run JSHint over my Jasmine tests using angular-mocks, i get errors for the "module" or "inject" function. How can I fix this? I know i can define those methods as globals in the .jshintrc, but is this the elegant way to solve this?

'module' is not defined 'inject' is not defined


Solution

  • As you can see here: https://github.com/angular/angular-seed/blob/master/.jshintrc The angular seed project follows that practice. So it seems to be quite accepted. I suggest you to copy the linked jshintrc.

    The file's content if the link would change:

    {
      "globalstrict": true,
      "globals": {
        "angular": false,
        "describe": false,
        "it": false,
        "expect": false,
        "beforeEach": false,
        "afterEach": false,
        "module": false,
        "inject": false
      }
    }