title: jest-jasmine2 env.js unhandled error
body: <p>I'm getting this cryptic error message when using Jest unit testing to test my code.</p>
  
  <blockquote>
    <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:198
        Unhandled error</p>
    
    <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:199
        Error
            at model.wrappedPointCut [as save] (/home/pi/dev/Group_2/node_modules/mongoose/lib/services/model/applyHooks.js:131:29)
            at /home/pi/dev/Group_2/controllers/Manager.js:80:17
            at Array.map ()
            at /home/pi/dev/Group_2/controllers/Manager.js:79:55
            at 
            at process._tickCallback (internal/process/next_tick.js:160:7)</p>
    
    <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:198
        Unhandled error</p>
    
    <p>console.error node_modules/jest-jasmine2/build/jasmine/Env.js:199</p>
  </blockquote>
  
  <p>Here's how my test code looks like</p>
  
  <pre><code>it.only('Adding a shift entry to DB works', () =&gt; {
    expect.assertions(3);
    return m.associateToShifts(["johnDoe"], ["Mondays"]).then(cmdResult =&gt; {
      expect(cmdResult.length).toBe(1);
      expect(cmdResult[0].employee.employeeId).toBe("johnd");
      expect(cmdResult[0].shift.shiftTitle).toBe("Mondays");
    }).catch(e =&gt; console.log(`Error: Cannot add shift to DB properly. ${e}`));
  });
  </code></pre>
  
  <p>Here's how my code in Manager.js looks like on line 70 - 81, which is what jest-jasmine2 is complaining about:</p>
  
  <pre><code>var employeeData = Promise.all(employees.map(function(emp) {
        emp.save();
  }));
  </code></pre>
  
  <p><code>employees</code> is an array of employee objects based on a mongoose <code>findOne()</code> employee query.</p>
  
  <p>The test passes despite having this error shown. </p>
  
  <p>Here are some things I've tried: 1) Update Jest to version 22.0.6 2) Update Node JS to version 9.4.0. None of those attempts have worked.</p>