lundi 23 juillet 2018

Mocha test ignoring errors

I'm trying to write a test, where a function is expected to throw an error.

it("function throws an expected error", function(done){
                return someAsyncError().then(function(){
                    expect(1).to.be.equal(1)
                })                      
            })

this test will alwys fail due to the error. how do I catch the error so the test will be true? I dont want to use expect(someAsyncError).to.throw()

Aucun commentaire:

Enregistrer un commentaire