error 'document' is not defined : eslint / React
In your package.json
, specify the test environment for jest as "jsdom"
as follows:
"jest": {
"testEnvironment": "jsdom"
}
I faced the same issue and it worked well for me.
Add "browser": true
your env
to include global variables (like document, window, etc.)
See the ESLint environment documentation for more information.
set an env property in you eslint.rc file, e.g.
{
"env": {
"browser": true,
"node": true
}
}