Protractor Exits with code 0 even though tests are failing
<p>I am running protractor v4.0.9 via npm, and noticed that my build on Visual Studio Team Services does not fail even when tests are reported as failing.  Looking into this further, I introduced an error so that tests would fail and then ran them locally.  As the screenshot below shows, I have 17/17 failing tests, but the exit code is still 0, which I understand is a success.  It even says <code>chrome #01 passed</code>, which I assume is wrong.</p>

<p><a href="https://i.stack.imgur.com/rVCQz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rVCQz.png" alt="protractor passing when it should fail"></a></p>

<p>Here is my protractor config:</p>

<pre><code>"use strict";
exports.config = {
    baseUrl: process.env.npm_package_config_baseUrl,
    framework: 'jasmine',
    capabilities: {
        browserName: 'chrome'
    },
    specs: ['test/*.spec.js'],
    rootElement: 'se-app',
    directConnect: true,
    ignoreUncaughtExceptions: false,
    onPrepare: function () {
        var globals = require('protractor');
        var browser = globals.browser;
        browser.ignoreSynchronization = true;
        browser.manage().window().maximize();
        var specReporter = require('jasmine-spec-reporter');

        // add jasmine spec reporter
        jasmine.getEnv().clearReporters();
        jasmine.getEnv().addReporter(new specReporter({
            displayStacktrace: false
        }));

        var reporters = require('jasmine-reporters');
        jasmine.getEnv().addReporter(new reporters.JUnitXmlReporter({
            savePath: 'junit/'
        }));
    },
};
</code></pre>

<p>I checked the <a href="https://github.com/angular/protractor/blob/master/lib/config.ts" rel="nofollow noreferrer">documentation for the Protractor config</a> but could not see any obvious settings that would cause this to happen.  I even added in <code>ignoreUncaughtExceptions:false</code> (shown above) to be explicit but it made no difference.</p>