title: what happens when a Promise never resolves?
body: <p>I have this very confusing snippet of code using es6 <code>async</code> <code>await</code> syntax. What I would expect to happen is that the process hangs on the <code>await</code> line forever, since the resolve function is never called. However, what actually happens is that "start" is outputted and then the process exits with no more output.</p>
  
  <pre><code>const simple = async () =&gt; {
    console.log('start')
    await new Promise(resolve =&gt; {})
    console.log('done.')
  }
  simple()
  </code></pre>
  
  <p>this code below however, will print "start", wait 1 second, and the print "done."</p>
  
  <pre><code>const simple = async () =&gt; {
    console.log('start')
    await new Promise(resolve =&gt; setTimeout(resolve, 1000))
    console.log('done.')
  }
  simple()
  </code></pre>
  
  <p>My closest guess to what this means (without any evidence) is that while node is waiting on a promise, it keeps track of the active things happening in your code, when there is nothing else happening, it simply exits. Can someone explain why the code exits here?</p>
  
  <p>running <code>node v8.7.0</code></p>