-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Globals for TDD frameworks (mocha, jasmine) #1330
Comments
If there are only two globals, I suggest using the |
It's usually more than just two globals with
The most annoying part is that, if you work with |
I think this issue was closed prematurely. IMO, a code-quality tool should do it's best to support testing frameworks. This is a sample globals block for Jasmine, as you can see it's quite cumbersome to set up for each project: "globals": {
"describe": false,
"xdescribe": false,
"ddescribe": false,
"it": false,
"xit": false,
"iit": false,
"beforeEach": false,
"afterEach": false,
"expect": false,
"pending": false,
"spyOn": false
} |
@davidagee I don't disagree with you, but your case is better made with a pull request containing a patch with tests. |
I dunno, is it really that bad? these days you can just inherit your base .jshintrc and extend it with the globals your tests need, so you don't have to maintain two lists, which is nice. Here's the thing, some day jasmine or mocha or qunit or mjsunit or whateverunit will decide they want to add In other words, there's a maintenance cost to these lists. |
Yeah, this is too compelling. Previous statement retracted, no patches welcome. |
@davidagee both these options are already available in 2.5.1+ Lines 649 to 679 in 54c2900
|
The trouble with the mocha global (describe, it, etc.) is that it combines TDD and BDD. If you follow the official recommendation of selenium-webdriver and Mocha here you will get a lint error on "test = require('selenium-webdriver/testing')" because "test" is being redefined. It's defined once using the "mocha" global in .jshintrc, and again here. This could be solved if the TDD and BDD globals were made distinct, e.g. "mocha-bdd": true. |
In jshint 2.5.1+, Mocha vars are included with jshint. See jshint/jshint#1330
Since contribution guide requires issue before commit && because I want to get approval first:
It seems like every JS project created since 2010 has to add describe, it etc to global.
Can we add globals for Jasmine and Mocha to whitelist, please?
Or, if you don't want to pollute globals, some generic 'tdd' option with at least describe and it could be great.
The text was updated successfully, but these errors were encountered: