title: Does Jest run test suites defined with describe() asynchronously?
body: <p><strong>Summary of problem:</strong> I'm writing several test suites (using Jest and Puppeteer) to automate tests for my AngularJS app's index.html page. Unfortunately, I'm seeing some odd behavior when I run my tests, which I think is related to the order in which Jest runs my various test suites.</p>
  
  <p><strong>Background:</strong> I'm using Jest (v24.8.0) as my testing framework. I'm using Puppeteer (v1.19.0) to spin up and control a Chromium browser on which to perform my tests.</p>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>&lt;!-- index.html --&gt;
  &lt;div ng-app="myApp" ng-controller="myCtrl as ctrl"&gt;
      &lt;form name="form1"&gt;
          &lt;md-input-container&gt;
              &lt;label class="md-required"&gt;Name&lt;/label&gt;
              &lt;input ng-model="ctrl.name1"&gt;&lt;/input&gt;
          &lt;/md-input-container&gt;
          &lt;md-dialog-actions&gt;
              &lt;button class="md-primary md-button" ng-transclude type="submit"&gt;Submit&lt;/button&gt;
          &lt;/md-dialog-actions&gt;
      &lt;/form&gt;
      &lt;form name="form2"&gt;
          &lt;md-input-container&gt;
              &lt;label class="md-required"&gt;Name&lt;/label&gt;
              &lt;input ng-model="ctrl.name2"&gt;&lt;/input&gt;
          &lt;/md-input-container&gt;
          &lt;md-dialog-actions&gt;
              &lt;button class="md-primary md-button" ng-transclude type="submit"&gt;Submit&lt;/button&gt;
          &lt;/md-dialog-actions&gt;
      &lt;/form&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <pre><code>// index.spec.js
  const puppeteer = require('puppeteer');
  
  (async () =&gt; {
      const browser = await puppeteer.launch({headless: false});
      const page = await browser.newPage();
      await page.goto('https://my-site.com');
  
      describe('form 1', async () =&gt; {
          test('populate form 1', async () =&gt; {
              let formSelector = 'form[name="form1"]';
              await page.waitForSelector(formSelector+' input', {timeout: 3000});
              await page.click(formSelector+' input');
              await page.keyboard.type('casey');
              let submitButtonSelector = 'form[name="form1"] button[type="submit"]';
              await page.click(submitButtonSelector);
          });
      });
      describe('form 2', async () =&gt; {
          test('populate form 2', async () =&gt; {
              let formSelector = 'form[name="form2"]';
              await page.waitForSelector(formSelector+' input', {timeout: 3000});
              await page.click(formSelector+' input');
              await page.keyboard.type('jackie');
              let submitButtonSelector = 'form[name="form2"] button[type="submit"]';
              await page.click(submitButtonSelector);
          });
      });
      await browser.close();
  })();
  </code></pre>
  
  <p><strong>Test Behavior:</strong>
  <em>Sometimes</em> when I run <code>npm test</code> it seems that my two test suites, <code>'form1'</code> and <code>'form2'</code> (which I defined with <code>describe</code>), are being run in parallel (although I know that's not possible in Javascript, so I am assuming Jest runs different test suites asynchronously). Either way, when I run my tests in non-headless mode, I can see that <code>form1</code>'s name input is populated with <code>'jackie'</code>, even though it should be <code>'casey'</code>. After that happens, <code>form2</code> is never filled out (even though my second test suite is supposed to do just that) and the tests complete, after which Jest informs me that <code>'populate form 2'</code> has failed. Again, this doesn't happen <em>every</em> time I run my tests, so you may not be able to replicate my problem. </p>
  
  <p><strong>My Questions:</strong></p>
  
  <ol>
  <li><p>Does Jest run test suites in parallel/asynchronously? <em>Note:</em> I'm not talking about individual test's defined with <code>test</code> within the test suites, I know that those are run asynchronously if I pass them an <code>async</code> function.</p></li>
  <li><p>If Jest does run test suites asynchronously, how do I disable that? Or better yet, is smart/conventional/optimal to give different test suites different <code>browser</code> instances so that they are run in completely separate windows? Are there any other methods for ensuring test suites are run separately and/or synchronously?</p></li>
  <li><p>If Jest does not run test suites asynchronously, then why do you think I'm seeing this behavior? </p></li>
  </ol>
  
  <p>I'm asking because I'd like to find a way to ensure that all my tests pass all of the time, instead of just some of the time. This will make it easier in the long run to determine whether or not my changes during development have broken anything.</p>
  
  <p>Thanks in advance to all you Jest/Puppeteer hackers out there!</p>