I m actually unit testing my little library and I m facing a problem with async tests.
In fact, when I try to run my test using the done function (in the "it" block), I've got a time out.
beforeEach(function() {
_componentInstance = new ComponentLoader();
});
describe('FindComponent function with path and no exclusion',function(){
this.timeout(15000);
it('Should return a promise with an array result',function(done){
_componentInstance.findComponent('./dist/lib/component/*').then(function(result){
console.log(result) // gives the good resultset
expect(result[0]).to.equals('./dist/lib/component/testComponentLoaderfzfzf.js'); // this file doesn't exist, I need to fail this test
done(); // got a timeout after 15 secs
});
});
});
When I try to console log the promise resultset, it works great, I have the list of file in the concerned directory.
But when I try to test using expect with chai, I've got a timeout...
I dont know what is going wrong there.
Aucun commentaire:
Enregistrer un commentaire