dotenv jest

JavaScript
// package.json
{  
  "scripts": 
  	{ 
      "test": "jest --setupFiles dotenv/config"  
    }
}
Source

Also in JavaScript: