beforeAll is fired even when not in the current describe.only context

🐛 Bug Report

When a test file has several describe() contexts, and one of them if focused using describe.only(), beforeAll() methods in all other contexts are still fired, even if no tests of those contexts are actually run.

This seems similar to https://github.com/facebook/jest/issues/8379, but this time regarding .only() and not .skip().

To Reproduce

The following test file exhibits the issue:

describe('context', () => {
  describe.only('foo', () => {
    it('should work', () => {
      expect(true).toEqual(true);
    });
  });
  describe('bar', () => {
    beforeAll(() => {
      console.info("[beforeAll]: this should not appear");
    });
    beforeEach(() => {
      console.info("[beforeEach]: this should not appear");
    });
    it('should not be run', () => {
      expect(true).toEqual(true);
    });
  });
});

Output: image

Expected behavior

None of the console.log should be called. The correct behavior of the beforeEach should also be applied to beforeAll.

Link to repl or repo (highly encouraged)

Live demo or repo to clone.

Run npx envinfo --preset jest

  System:
    OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
  Binaries:
    Node: 10.11.0 - ~/.nvm/versions/node/v10.11.0/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.11.0/bin/npm
  npmPackages:
    jest: 24.8.0 => 24.8.0