title: Mocha - How can I set a variable with a before block?
body: <p>My example has</p>
  
  <pre><code>let resort30 = new Resort('Alta');
  </code></pre>
  
  <p>at the top of the file and then uses it within the the test case, i.e.</p>
  
  <pre><code>let alta = new Visit(resort30, '03/01/2000'); // Note this is before any describe
  </code></pre>
  
  <p>That works.  However if I create a <code>before</code> or <code>beforeEach</code> within the <code>describe</code> and before all the <code>it</code>s with:</p>
  
  <pre><code>before(function () {
    let resort30 = new Resort('Alta');
  });
  </code></pre>
  
  <p>and comment out the original declaration, then <code>resort30</code> isn't recognized with</p>
  
  <pre><code> ReferenceError: resort30 is not defined                                                                                                  
    at Context.&lt;anonymous&gt; (test/ski_resorts_using_befores.spec.js:52:26)  
  </code></pre>
  
  <p>How can I get it to work when I move that variable into the <code>before</code> or <code>beforeEach</code> so all <code>it</code>s can use it ?</p>
  
  <p>I don't want it at the top, I want it to be scoped to the describe as I plan more describes in this file.  Even with 1 describe , I want to be able to use <code>before</code> and beforeEach` for variables and objects i wanna create.</p>