I have been work with jest and when I use TDD and introduce a failing test, that is not work. This a a little example:
it("should be manage debounced actions", (done) => {
setTimeout(() => {
expect(true).toEqual(false);
done();
}, 500);
});
Result that I expect
expect(received).toEqual(expected)
Expected value to equal:
false
Received:
true
Actual Result
Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
I think that is a problem related to the expect method that throw an exception. I did this workaround:
it("should be manage debounce actions", (done) => {
setTimeout(() => {
try {
expect(true).toEqual(false);
done();
} catch(e) {
console.log(e.message);
done();
}
}, 500);
});
But I think that this is not the best Idea for resolve this. It is possible take a better approach for resolve this??
Aucun commentaire:
Enregistrer un commentaire