JSHint thinks Jasmine functions are undefined

前端 未结 4 1951
自闭症患者
自闭症患者 2020-12-29 20:34

I\'ve got a Grunt setup which uses Karma+Jasmine and JSHint. Whenever I run JSHint on my spec file, I get a series of \"undefined\" errors, most of which are for Jasmine\'s

4条回答
  •  隐瞒了意图╮
    2020-12-29 21:23

    MINOR CORRECTION - there should be "" around predef in the .jshintrc file.

    Fixed by adding this to the jshint options in my Gruntfile.coffee:

    predef: [
        "jasmine"
        "describe"
        "xdescribe"
        "before"
        "beforeEach"
        "after"
        "afterEach"
        "it"
        "xit"
        "it"
        "inject"
        "expect"
        "spyOn"
    ]
    

    .jshintrc:

    "predef": [
        "jasmine",
        "describe",
        "xdescribe",
        "before",
        "beforeEach",
        "after",
        "afterEach",
        "it",
        "xit",
        "it",
        "inject",
        "expect",
        "spyOn",
    ]
    

提交回复
热议问题