Promises change the exitCode of the jenkins job, how to prevent this?
<p>I have the following reporters in the protractor.conf file:</p>

<pre><code> var promise1 = new Promise(function (resolve) {
    reporter1.afterLaunch(resolve.bind(this, exitCode));
});

var promise2 = new Promise(function (resolve) {
    reporter2.afterLaunch(resolve.bind(this, exitCode));
});

return Promise.all([promise1, promise2]);
</code></pre>

<p>Each of the above reporters have their own afterlaunch that would be expected to execute once the afterlaunch in the ptor.conf file is executed.</p>

<p>This is a part of the continuous integration job in Jenkins. So what's happening is that the promise resolves so the exit code of the process becomes 0, even when a test fails hence overwriting the exit code of the job. So even though its a legit failure the jenkins shows the entire job as PASSED. I need to preserve the original value of <code>exitCode</code> that is being passed to the above reports for the jenkins job to function as expected. How can we prevent this?</p>