F
F
frontendo2017-09-29 21:57:38
Software testing
frontendo, 2017-09-29 21:57:38

Why does mocha throw an exception on the first failed test and exit?

Wrote tests, here is the first one

describe('Register test', function() {
  it('should return errors on empty request', function(done) {
    server.post('/register').end(function(err, res) {
      res.status.should.equal(422);

      const schema = {
        properties: {
          errors: {
            type: 'object',
            required: ['email', 'password', 'password_confirm'],
            properties: {
              email: { type: 'string' },
              password: { type: 'string' },
              password_confirm: { type: 'string' }
            }
          }
        }
      };

      ajv.validate(schema, res.body).should.be.true();
      done();
    });
  });

  it(...

I specifically send another code so that the test fails.
But not only does it not pass, mocha does not catch the exception and crashes
joxi.ru/Vm6Ra87txbREPm

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question