-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add "env" config to package.json #371
Comments
IMHO, if |
bad, mocha. one of the reasons I don't use mocha anymore. :p |
@rstacruz What is better than mocha? |
I personally prefer tape, but that's just me. Anyway, IMHO this is most certainly doable. Eslint itself has support for environments defined here: http://eslint.org/docs/user-guide/configuring#specifying-environments. These look particularly useful:
|
Also, @feross, this might be worth documenting: /* eslint-env mocha */ ...will consider describe/it/beforeEach/etc as predefined globals. |
I guess if it is basically just a direct pass-through for a common eslint feature, then I'm not against it. |
Though, IMHO Make the lame things hard, and the bad things impossible |
yes, i agree. there's also the possibility of this: {
"scripts": {
"lint": "standard 'lib/*.js'; standard 'test/**/*.js' --env mocha"
}
} |
@rstacruz that I would agree with a lot more than the blanket suggestion. |
@rstacruz Seems like they require to write this in every single test file:
Grows old very fast, imo. |
@dmitriz: i know this is off tangent in the conversation now, but that's precisely why I like it. It means you have write your test files in idiomatic JavaScript—no fancy test runners. In practice, it means your tests are runnable on their own ( node test.js # run in node.js
hihat test.js # run in electron (hihat is browserify-aware)
budo test.js # run in browser (budo is, too)
browserify test.js | smokestack -b firefox # run in headless browser |
@rstacruz I see, interesting, have you seen ava - that looks similar! |
@rstacruz Interesting info ;-) |
@rstacruz +1 to It's not worth saving one line if you break compatibility with everything. All tooling has to add custom support for mocha and know about the exact list of globals that mocha assumes. Not a good tradeoff. |
That said, we'll support passing through this option to |
So users can specify custom rules. Works in `package.json`: ```json { "standard": { "env": { "mocha": true } } } ``` And the command line: ``` standard --env mocha test/*.js ``` For users that need to change the environment across their entire project, or just for their tests (e.g. with mocha). Fixes standard/standard#371
PR to Works in {
"standard": {
"env": {
"mocha": true
}
}
} And the command line:
This will be released in standard v6. |
As a continuation of #18, can we add this?
IMHO it's better than either adding
/* eslint-env mocha */
to all test files, or adding:The text was updated successfully, but these errors were encountered: