AndrewKeig/express-validation

Test Timeout - jasmine.DEFAULT_TIMEOUT_INTERVAL

Closed this issue · 3 comments

I'm using your middleware with joi. When I added your middleware validation function the tests started to throw a timeout exception (see message bellow).

It sounds weird because I'm testing only Nodejs code, not in a browser.

The validation rule is:

body: {
    to: Joi.string().required()
  }

The error message:

 FAIL  src/api/chat/index.test.js (100.512s)
  ● POST /chat/send 201 (user)

    Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
      
      at ontimeout (timers.js:365:14)
      at tryOnTimeout (timers.js:237:5)
      at Timer.listOnTimeout (timers.js:207:5)

Yes, I do.

if (req.error && req.error.status) {
      res.status(req.error.status).json(req.error);
    } else {
      next(err);
    }

Closing, released 3.0