Eslint angular and jasmine: is not defined no-undef Eslint angular and jasmine: is not defined no-undef angularjs angularjs

Eslint angular and jasmine: is not defined no-undef


Adding

"env": { "jasmine": true}

solved the problem. This was the suggestion that i got through the github page of the eslint jasmine plugin.


With this rule set, any variable non explicitly declared causes a warning.You can set at the top of your spec file:

/* global describe it expect */


You can add /* eslint-env jasmine */ to the top of your .spec.ts files. This is basically the same solution as the one proposed by Geert, but with a per-file solution. The subtle difference is that it will still be an error to use some of the globally defined test methods like describe() and it() in your non-test files.

(There is probably a clever way to set up ESLint, so that you don't have add this line to all the .spec.ts files.)