Promise not waiting to resolve before next then
<p><strong>Code:</strong></p>

<pre><code>var x = new Promise((resolve, reject) =&gt; {
    setTimeout( function() {
        console.log( 'x done' );
        resolve()
    }, 1000 );
});


Promise.resolve().then(x).then((resolve, reject) =&gt; {
    console.log( 'all done' );
});
</code></pre>

<p><strong>Output:</strong></p>

<pre><code>all done
x done
</code></pre>

<p><strong>Expected output:</strong></p>

<pre><code>x done
all done
</code></pre>

<p>Why is the promise <code>x</code> not waiting to resolve before calling the next <code>then</code> callback?</p>

<p><strong>JSFiddle</strong>: <a href="https://jsfiddle.net/puhbqtu0/1/" rel="noreferrer">https://jsfiddle.net/puhbqtu0/1/</a></p>