ReferenceError: done is not defined
at Request._callback (/Users/john/Sites/symble/Backend/test/routes.js:43:4)
at Request.callback (/Users/john/Sites/symble/Backend/test/node_modules/request/main.js:108:22)
at Request.<anonymous> (/Users/john/Sites/symble/Backend/test/node_modules/request/main.js:468:18)
at Request.emit (events.js:67:17)
at IncomingMessage.<anonymous> (/Users/john/Sites/symble/Backend/test/node_modules/request/main.js:429:16)
at IncomingMessage.emit (events.js:88:20)
at HTTPParser.onMessageComplete (http.js:137:23)
at Socket.ondata (http.js:1137:24)
at TCP.onread (net.js:354:27)
It seems to happen randomly - on different tests each time. It always happens twice (ie: I get two of the above errors on two tests).
lomse, chaim1221, aliechihabi, wewark, puruverma0001, and letiesperon reacted with laugh emoji
lomse, chaim1221, aliyeysides-vg, dallashuggins, and varun27896 reacted with hooray emoji
ismailaidar, anhtranEH, and MonkeyKiing25 reacted with heart emoji
All reactions
can i call the done method in a loop?
var list = {"a": 1,"b":2,"c":3};
for(var i in list) {
it('should test 【' + list[i] +'】', (function(type) {
console.log(type);
save(done);
})(i);
It report error with done is not defined.
@Munter Thanks very much! I change my code as follow
var list = {"a": 1,"b":2,"c":3};
for(var i in list) {
(doIt)(i);
function doIt(type) {
it('should test 【' + list[type] +'】', function(done) {
console.log(type);
save(done);
});
it works, but i do not understand why, can you explain it with more detail?