title: Jest + process.env.NODE_ENV not testing properly
body: <p>I have a config file that changes a variable based on the <code>process.env.NODE_ENV</code> here is the function:</p>
  <pre class="lang-js prettyprint-override"><code>const { hostname } = window.location
  
  let USE_DEV_TOOLS = false
  if (
    hostname === 'qa.example.com' ||
    hostname === 'dev.example.com' ||
    NODE_ENV !== 'production'
  ) {
    USE_DEV_TOOLS = true
  }
  </code></pre>
  <p>In my test I want to test that if <code>NODE_ENV</code> is production, <code>USE_DEV_TOOLS</code> returns <code>false</code> however, if I try to change the <code>NODE_ENV</code> it updates after getting the variable.</p>
  <pre class="lang-js prettyprint-override"><code>import config from 'consts/config'
  describe('Environment variables', () =&gt; {
    const ORIGINAL_ENV = process.env
    beforeEach(() =&gt; {
      jest.resetModules()
      process.env = { ...ORIGINAL_ENV }
    })
  
    afterAll(() =&gt; {
      process.env = ORIGINAL_ENV
    })
  
    it('production does not use dev tools', () =&gt; {
      process.env = { NODE_ENV: 'production' }
  
      // console logs properly, but is changing after I get config
      console.log(process.env.NODE_ENV) 
  
      expect(config.USE_DEV_TOOLS).toBe(false)
    })
  }) 
  </code></pre>