I would like to get rid of global variables in my Jest test code. Specifically describe
, it
and expect
:
describe('Welcome (Snapshot)', () => {
it('Welcome renders hello world', () => {
...
});
});
So I tried to add:
import {describe,it} from 'jest';
and
import jest from 'jest';
jest.describe( ...
jest.it( ...
And other variations...
But no luck.
How should I get it working?
The simplest solution for this is adding jest: true
to your env
configuration in ESLint, like so:
"env": {
"browser": true,
"node": true,
"jasmine": true,
"jest": true,
"es6": true
},