-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
done() is not defined #232
Comments
Look over your code again. Line 43 in the gist... in that method, "done" really isn't defined. It has no "function(done)" but rather "function()". That is, add the parameter 'done' to line 36 as you have in line 22. |
Oops, sorry! Looks like I'm a turnip. Thanks @jprichardson :) |
kinda lame but this should suffice
can i call the 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 |
@callblueday The function signature for the second argument of |
@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? |
executing your first setup would execute the inlined iife immediately and likely return undefined, making the test always pass immediately. tests need a callback function to call when the test should be run, which is what you are doing in your last example. |
Thanks again @Munter , that's very kind of you. |
Hey there,
I have a unit test script which can be seen here: https://gist.github.com/3bc91203fb434a19e9e4
The problem is that tests return the following:
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).
The text was updated successfully, but these errors were encountered: