title: How to mock a global variable in a class
body: <p>I have a class file, <code>someClass.js</code> that looks like:</p>
  
  <pre><code>//assigns globalVar from some file
  const globalVar = getFromFile() //returns a string such as "some global var"
  
  export default class SomeClass {
    ...
    public static someFunc() {
       if (globalVar == "Hello"){
         return 2
       }
       else {
         return 3
       }
    }
  </code></pre>
  
  <p>And in my test file, I'm importing it as so:</p>
  
  <pre><code>import SomeClass from './someClass';
  </code></pre>
  
  <p>In my tests I want to overwrite the <code>globalVar</code> with different values for each test like this:</p>
  
  <pre><code>test('call someFunc with globalVar set to Hello', async () =&gt; {
    //set globalVar to "Hello"--how can I do this?
    const result = SomeClass.someFunc()
    expect(result).toBe(2)
  }
  </code></pre>
  
  <p>How can I do this? Is there any way to mock a <code>const</code>?</p>