javascript - Timeout while testing with mocha -


this question has answer here:

i trying write test case using mocha , mongoose. following snippet of code have written gives me error "todo "before each" hook: error: timeout of 2000ms exceeded. ensure done() callback being called in test." unable fing issue. beginner in node. can please me out on issue. in advance.

 var todo = require('../models/todo'),      should = require('should');      describe('todo', function(){        beforeeach(function(done){         faketodo = {           name    : 'xyz',           completed     : true,           note  : "this test note"         }         todo.remove(done);       });        describe('#save()', function(){         var todo;          beforeeach(function(done){            console.log('before each todo entry');           todo = new todo(faketodo);           console.log('before each todo exit');           done();         });           it('should have name property', function(done){           todo.save(function(err, todo){              should.not.exist(err);             todo.should.have.property('name', 'xyz');             done();           });         });           it('should not save if name not present', function(done){           todo.name = '';           todo.save(function(err, todo){             should.exist(err);             should.not.exist(todo.name);             done();           });         });       });      }); 

i'm not sure why you're trying todo.remove(done); why have in first place if you're not going call back?

i try changing: todo.remove(done);

to:done();

hope helps.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -