bcaudan/jasmine-spec-reporter

"Process exited with code 0" when tests failed.

VladimirKovalenko opened this issue · 1 comments

Bug report

Hello, guys.

My configuration

Windows 10
npm 5.3.0
node v8.4.0
jasmine 2.8.0
jasmine-spec-reporter 4.2.1
protractor 5.1.2

Previously I have used standard logger.
Recently I installed jasmine-spec-reporter and output became better.
But I have problem with TeamCity.
After test execution in TeamCity I alway have "Process exited with code 0", even if some tests failed.
With standard logger I didn't faced such problem.
Could you please suggest how to solve this issue, I realy like jasmine-spec-reporter but without correct error code I cannot integrate.

TeamCity output:

I/launcher - Running 1 instances of WebDriver
I/direct - Using ChromeDriver directly...
Jasmine started

1 LoginComponent
x should set focus to the Password field after incorrect password has been entered
- Expected false to be truthy.
at Function.CustomMatchers.expectToBeFocused (D:\TeamCity\BuildAgent\work\e2eng2\ng2\e2e\matchers\custom-matchers.ts:13:6)
at UserContext. (D:\TeamCity\BuildAgent\work\e2eng2\ng2\e2e\tests\login.e2e.ts:53:18)
at new ManagedPromise (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:1067:7)
at ControlFlow.promise (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2396:12)
at TaskQueue.execute_ (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2970:14)
at TaskQueue.executeNext_ (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2953:27)
at asyncRun (D:\TeamCity\BuildAgent\work\e2eng2\ng2\node_modules\selenium-webdriver\lib\promise.js:2860:25)

  •                Failures                    *
    
  1. LoginComponent should set focus to the Password field after incorrect password has been entered
  • Expected false to be truthy.

Executed 1 of 9 specs (1 FAILED) (8 SKIPPED) in 10 secs.
I/launcher - 0 instance(s) of WebDriver still running
I/launcher - chrome #1 passed
Process exited with code 0

My protractor.conf.js

require('ts-node').register({
compilerOptions: {
noEmitHelpers: false
}
});
var helpers = require('./helpers');
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;

exports.config = {
baseUrl: 'http://localhost:8080/ng2/',

// use npm run e2e
specs: [
helpers.root('e2e/**/*.e2e.ts')
],
exclude: [],

framework: 'jasmine2',

allScriptsTimeout: 110000,

jasmineNodeOpts: {
defaultTimeoutInterval: 600000,
print: function() {}
},
directConnect: true,

capabilities: {
'browserName': 'chrome',
chromeOptions: {
args: [
'--start-maximized'
]
}
},

onPrepare: function() {
browser.ignoreSynchronization = true;
jasmine.getEnv().clearReporters();
jasmine.getEnv().addReporter(new SpecReporter({
displayStacktrace: 'all',
suite: {
displayNumber: true,
},
spec: {
displayPending: true,
displayStacktrace: true,
},
summary: {
displayDuration: true,
},
prefixes: {
successful: '+ ',
failed: 'x ',
},
}));
},

useAllAngular2AppRoots: true
};

Check with "x":

Current behavior
Process always exited with code 0

Expected behavior
Process exited code must be depend on test execution result.

Hello.

I solved this issue.
My problem was that I kill all other reporters.
To fix it it is enough to delete this row

jasmine.getEnv().clearReporters();