vendredi 28 décembre 2018

Mocha says test suceeded but it threw an exception

I am running some unit tests with mocha. One of my methods called in the unit tests throws an exception. As such, I would like that the test is reported to have failed. However, mocha logs the exception and says the test has succeeded.

import * as mocha from 'mocha';

mocha.describe('Tests Disassembler', () => {

it('simple test', () => {
    throw new Error("failed");

});

});

Is there any way of telling mocha the test should be reported as failed if there is an uncaught exception?

Aucun commentaire:

Enregistrer un commentaire