Issue with Mocha Testing Suite

Hi All! I’m working on a Codecademy pro project and can’t figure out how to debug a particular failed test. There are more tests after these two failed tests but they won’t even run right now so the only feedback i get after all the passing tests from running ‘npm test’ is as follows:

DELETE /api/series/1 404 7.147 ms - 154
    ✓ should remove the series with the specified ID from the database if that series has no related issues
    1) "before each" hook

  GET /api/series/:seriesId/issues
    2) "before each" hook for "should return all issues of an existing series"


  49 passing (16s)
  2 failing

  1) DELETE /api/series/:id "before each" hook for "should return all issues of an existing series":
     TypeError: Cannot read property 'call' of undefined


  2) DELETE /api/series/:id "before each" hook for "should return all issues of an existing series":
     TypeError: Cannot read property 'call' of undefined


Can anybody help me figure out how to find out in more detail what could be causing this issue?

1 Like

So I’m not exactly sure what the issue was but a thread on stack overflow suggested it may have been the default timeout was being reached. So first I commented out the test in test.js that I was having trouble passing. This allowed the remaining tests to run with “npm test”. From there I was able to finish the rest of the project, although I did add .timeout(4000) after many of the it(…) Statements which helped pass some of the tests. I’m working on a slow laptop so it’s possible that was the issue when working with mocha.

1 Like

You likely already solved the problem However, for anyone looking for the answer see the above discussion on the exact same topic.

Coding High Fives all around
Rick