title: JEST: "Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.", despite it being already configured
body: <p>Before you point it out, yes, I know this seems like a likely duplicate of multiple questions like;</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/49603939/jest-async-callback-was-not-invoked-within-the-5000ms-timeout-specified-by-jest">JEST: Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout</a></li>
  <li><a href="https://stackoverflow.com/questions/49725389/got-timeout-async-callback-was-not-invoked-within-the-5000ms-timeout-specified">Got Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout</a> </li>
  </ul>
  
  <p>However, I implemented all 3 fixes suggested;</p>
  
  <ul>
  <li>Use <code>jest.setTimeout()</code> inside the test to set the async timeout</li>
  <li>Use the third parameter of <code>test()</code> to pass in an extended async timeout limit</li>
  <li>Call the <code>done</code> function when complete</li>
  </ul>
  
  <p>However, when running my jest test on an automated linux machine (Jenkins), it's still throwing the same error. Also, it's worth mentioning this works fine on my MacOS machine running NodeJS v10, while the automated linux machine runs NodeJS V8.8.3 (the latest LTS version)</p>
  
  <p>This is what my jest test looks like;</p>
  
  <pre><code>const webdriverio = require('webdriverio');
  const options = {
      desiredCapabilities: {
          browserName: 'chrome',
          chromeOptions: {
              args: ["--no-sandbox", "disable-web-security", "--disable-dev-shm-usage"]
          } 
      } 
  };
  const client = webdriverio.remote(options);
  
  beforeEach(async () =&gt; {
      await client.init();
  })
  
  test('Google Search for WebdriverIO has correct title', async (done) =&gt; {
      jest.setTimeout(30000)
      await client.url('https://www.google.com/ncr');
      await client.setValue('input[name=q]', 'WebdriverIO');
      await client.click('input[value="Google Search"]');
      const title = await client.getTitle();
      expect(title).toBe('WebdriverIO - Google Search');
      done();
  }, 30000);
  
  afterEach(async () =&gt; {
      await client.end();
  });
  </code></pre>
  
  <p>And here is the log I get when I try to run the test;</p>
  
  <pre><code>09:57:19 &gt; jest --config jest.config.js
  09:57:19 
  09:57:20 Installing selenium server ...
  09:57:22 Starting selenium server ...
  09:57:23 Selenium server started ...
  09:57:29 FAIL jest/test/google.spec.js (5.874s)
  09:57:29   ��� Google Search for WebdriverIO has correct title (5016ms)
  09:57:29 
  09:57:29   ��� Google Search for WebdriverIO has correct title
  09:57:29 
  09:57:29     Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.
  09:57:29 
  09:57:29       at mapper (node_modules/jest-jasmine2/build/queue_runner.js:41:52)
  09:57:29 
  09:57:29   ��� Google Search for WebdriverIO has correct title
  09:57:29 
  09:57:29     A session id is required for this command but wasn't found in the response payload
  09:57:29 
  09:57:29       at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)
  09:57:29       at RequestHandler.createOptions (node_modules/webdriverio/build/lib/utils/RequestHandler.js:121:23)
  09:57:29       at RequestHandler.create (node_modules/webdriverio/build/lib/utils/RequestHandler.js:212:43)
  09:57:29       at Object.url (node_modules/webdriverio/build/lib/protocol/url.js:24:32)
  09:57:29       at Object.exec (node_modules/webdriverio/build/lib/helpers/safeExecute.js:28:24)
  09:57:29       at Object.resolve (node_modules/webdriverio/build/lib/webdriverio.js:191:29)
  09:57:29       at lastPromise.then.resolve.call.depth (node_modules/webdriverio/build/lib/webdriverio.js:486:32)
  09:57:29       at _fulfilled (node_modules/q/q.js:854:54)
  09:57:29       at self.promiseDispatch.done (node_modules/q/q.js:883:30)
  09:57:29       at Promise.promise.promiseDispatch (node_modules/q/q.js:816:13)
  09:57:29 
  09:57:29 Test Suites: 1 failed, 1 total
  09:57:29 Tests:       1 failed, 1 total
  09:57:29 Snapshots:   0 total
  09:57:29 Time:        5.988s, estimated 7s
  09:57:29 Ran all test suites.
  09:57:29 Killing selenium server ...
  </code></pre>
  
  <p>Any thoughts on why this could fail while it works fine on my local machine would be greatly appreciated. Also, I tried setting <code>jest.setTimeout</code> inside my Jest global setup file, but it throws <code>jest.setTimeout is not a function</code>;</p>
  
  <p><a href="https://github.com/facebook/jest/issues/3788" rel="noreferrer">https://github.com/facebook/jest/issues/3788</a></p>