Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  178] [ 7]  / answers: 1 / hits: 47177  / 9 Years ago, sun, may 3, 2015, 12:00:00

I have a Mocha test file that looks like this:



var expect = require('chai').expect
var muting = require('../muting')

describe('muting', function () {
describe('init()', function () {
it('should inject an object into twitter', function () {
var twitter = 'twitter'
muting.init(twitter)
expect(muting.twitter).to.equal(twitter)
})
})
})


When I run mocha from the CLI, it runs the test successfully.



When I run standard (the executable for JavaScript Standard Style) I get errors on Mocha's framework functions like so:



standard: Use JavaScript Standard Style (https://github.com/feross/standard)   
c:..testindex.js:5:0: 'describe' is not defined.
c:..testindex.js:6:2: 'describe' is not defined.
c:..testindex.js:7:4: 'it' is not defined.


What's the cleanest way to make Standard not complain about these functions?


More From » mocha.js

 Answers
24

Actually, you don't need to list every single global variable in your package.json



You can specify environments instead like this:



standard: {
env: [ mocha ]
}


Source: Official ESLint configuration docs.


[#66767] Friday, May 1, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaileya

Total Points: 168
Total Questions: 95
Total Answers: 72

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;