title: superagent / supertest with async / await
body: <p>Goal is to set the variable <code>auth</code> correctly for further use, hence i want to refactor the function loginUser:</p>
  
  <pre><code>function loginUser(user, request, auth) {
    return function(done) {
      request
        .post('/users/login')
        .send(credentials)
        .expect(200)
        .end(onResponse);
  
      function onResponse(err, res) {
        auth.token = res.body.token;
        return done();
      }
    };
  }
  
  
   loginUser(user, request, auth)(function() {
    request.get(testUrl)
      .set('Authorization', `bearer ${auth.token}`)
      .expect(200, done);
  });
  </code></pre>
  
  <p>to use async / await like this (without the callback):</p>
  
  <pre><code>auth = await loginUser(user, request);
  request.get(testUrl)
      .set('Authorization', `bearer ${auth.token}`)
      .expect(200, done);
  </code></pre>
  
  <p>But i am struggling of returning / setting <code>auth</code> correctly (it would not matter if i pass <code>auth</code> as parameter or as return value).</p>
  
  <p>What i tried was stuff like this:</p>
  
  <pre><code>async function loginUser(user, request) {
    let auth;
    await request
      .post('/users/login')
      .send(credentials)
      .expect(200)
      .end(onResponse);
  
    function onResponse(err, res) {
      auth.token = res.body.token;
    }
    return auth;
  }
  </code></pre>
  
  <p>But <code>auth</code> was never set correctly.</p>