title: Jest messageParent can only be used inside a worker
body: <p>Is there a way to get a proper error message?</p>
  <p>when i do</p>
  <p><code>$npm test</code></p>
  <p>and I intentionally break my code(cough cough remove a line of code)
  I get this message</p>
  <pre><code>src/redux/drivers/driver.saga.spec.js
     Test suite failed to run
  
      &quot;messageParent&quot; can only be used inside a worker
  
        at messageParent (node_modules/jest-worker/build/workers/messageParent.js:46:11)
  </code></pre>
  <p>I believe this is a meaningless error message and it would be nice to have something meaningful (=.</p>
  <p>Here's my test</p>
  <pre><code>describe(&quot;DriverSocketFlow failed REASON:\n&quot;, () =&gt; {
    let socket;
    beforeEach(() =&gt; {
      socket = new MockedSocket();
      io.mockReturnValue(socket);
    });
    afterEach(() =&gt; {
      jest.restoreAllMocks();
    });
    const mockGeneratorPayload = { payload: { name: &quot;Royal Palms&quot; } };
    const generator = DriverSocketFlow(mockGeneratorPayload);
  
    test(&quot;Checking if DriverSocketFlow was called with it's methods and disconnected gracefully&quot;, () =&gt; {
      expect(generator.next(socket).value).toEqual(
        call(connect, mockGeneratorPayload.payload.name)
      );
      expect(generator.next(socket).value).toEqual(
        call(socketbug, mockGeneratorPayload.payload.name)
      );
      //disconnect gracefully
      expect(generator.next(socket).value).toEqual(
        fork(Read_Emit_Or_Write_Emit, socket)
      );
      expect(generator.next().value).toEqual(
        take(DriversActionTypes.DRIVERS_SOCKET_OFF)
      );
      expect(generator.next(socket).value).toEqual(call(disconnect, socket));
      expect(generator.next(socket).value).toEqual(call(disconnect, socket));
  
      expect(generator.next().value).toEqual(cancel());
    });
  });
  </code></pre>
  <p>It should say</p>
  <p><strong>DriverSocketFlow failed REASON:</strong></p>
  <blockquote>
  <p>Checking if DriverSocketFlow generator function was called and disconnected gracefully</p>
  </blockquote>
  <p>Thanks! for looking!</p>
  <p>....
  <strong>So i think i figured it out!</strong>
  here's my new test</p>
  <pre><code>test(&quot;1. Connected to the socket successfully&quot;, () =&gt; {
      expect(generator.next(socket).value).toEqual(
        call(Connect_To_Socket, mockGeneratorPayload.payload.name)
      );
      expect(generator.next(socket).value).toEqual(
        call(socketbug, mockGeneratorPayload.payload.name)
      );
    });
    test(&quot;2. Read_Emit_Or_Write_Emit generator function operations for socket.on and emit&quot;, () =&gt; {
      expect(generator.next(socket).value.payload.fn).toEqual(
        fork(Read_Emit_Or_Write_Emit, socket).payload.fn
      );
    });
  </code></pre>
  <p><strong>but i think it's bug within npm test</strong>
  Don't know why it does it, but if you stop watch in npm test within package.json script tag and restart the test...It should work.....</p>
  <pre><code>&quot;scripts&quot;: {
      &quot;test&quot;: &quot;react-scripts test --watchAll=false&quot;,
      
    },
  </code></pre>
  <p>and also....! don't know if this step helped but i added
  jest.config.js within the root directory and removed it then all of a sudden it worked... &quot; &lt;- cough cough it probably doesn't do anything just keep restarting it ¯_(ツ)_/¯.... it worked for me&quot;</p>
  <p>Here's the full code</p>
  <p><a href="https://github.com/reactnodej32/deliveryapp/blob/master/client/src/redux/drivers/drivers.saga.spec.js" rel="noreferrer">driver.saga.spec.js</a></p>