Hello kartik,
You must specify what environment (--env) are you going to use.
When you run jest command in the package.json you should specify the environment (jsdom or node). For example:
"scripts": {
"jest": "jest --env=node --colors --coverage test",
"test": "npm run jest"
},
This should work for you!