title: then() callback firing before promise is resolved in node.js
body: <p>Using node.js version 7.7.2, I'd like to execute an asynchronous function and then a different function once the first function has completed like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function foo() {
    return new Promise(function(resolve, reject) {
      // Do some async stuff
      console.log('foo is about to resolve');
      resolve();
    });
  }
      
  function bar(arg) {
    console.log(arg);
  }
  
  foo().then(bar('bar has fired'));</code></pre>
  </div>
  </div>
  </p>
  
  <p>The issue is that this setup prints 'bar has fired' followed by 'foo is about to resolve'.  What I expect is that bar will wait to fire until the promise returned by foo has resolved.  Am I misunderstanding how then() queues callbacks in the node.js event loop?</p>
  
  <p>Thanks </p>