-
-
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
How to return value in async testing via done
?
#1671
Comments
The above is a basic misunderstanding of programming. Once you I'm not sure really what I'm looking at here. Is describe('foo', function() {
var response;
beforeEach(function(done) {
someAsyncCall(function(err, data) {
response = data;
done();
});
});
it('should blah blah', function() {
// use response here
});
}); |
@boneskull How would you do this if |
@schatekar do what..? |
If I have defined |
I am testing my apis by using mocha. Since calling to my apis needs authorization, I call the authorization api to get the access token in the
beforeEach
hook. I wrap thedoFakeAuth
function in theutils.js
file and export it, which is denoted as follows.However, I cannot get the
res.body.token
in the async call. I also triedBut it said
Error: done() invoked with non-Error: <token detail>
.So how can I get the token in the caller.
The text was updated successfully, but these errors were encountered: