Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSHint thinks Jasmine functions are undefined

You can just add "jasmine": true to your .jshintrc file.


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",
]

I fixed this in Gruntfile.js adding jasmine: true to the options of the jshint task:

jshint:
{
    options:
    {
        ...
        node: true,
        jasmine: true,
        ...
    },
    ...
},

Like the OP, I'm not using a .jshintrc file either.