I would like to get rid of globals in my jest test code. Specifically describe
, it
and expect
describe('Welcome (Snapshot)', () => {
it('Welcome renders hello world', () => {
...
});
});
So I tried 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?
After I realized jest is running in node, it realized I could do this:
Not perfect, but one step closer.. now I don't need to configure my linter with globals anymore.
The simplest solution for this is adding
jest: true
to yourenv
config in eslint, like so: