Check for process.listeners as well, for GlobalErrors

- Fixes #1333
This commit is contained in:
Gregg Van Hove
2017-04-26 13:54:07 -07:00
parent 055d88eff8
commit 1d62504534
2 changed files with 4 additions and 4 deletions

View File

@@ -1068,7 +1068,7 @@ getJasmineRequireObj().Env = function(j$) {
this.it = function(description, fn, timeout) {
// it() sometimes doesn't have a fn argument, so only check the type if
// it's given.
if (arguments.length > 1) {
if (arguments.length > 1 && typeof fn !== 'undefined') {
ensureIsFunction(fn, 'it');
}
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
@@ -1082,7 +1082,7 @@ getJasmineRequireObj().Env = function(j$) {
this.xit = function(description, fn, timeout) {
// xit(), like it(), doesn't always have a fn argument, so only check the
// type when needed.
if (arguments.length > 1) {
if (arguments.length > 1 && typeof fn !== 'undefined') {
ensureIsFunction(fn, 'xit');
}
var spec = this.it.apply(this, arguments);
@@ -2174,7 +2174,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
this.uninstall = function noop() {};
this.install = function install() {
if (global.process && j$.isFunction_(global.process.on)) {
if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
var originalHandlers = global.process.listeners('uncaughtException');
global.process.removeAllListeners('uncaughtException');
global.process.on('uncaughtException', onerror);

View File

@@ -11,7 +11,7 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
this.uninstall = function noop() {};
this.install = function install() {
if (global.process && j$.isFunction_(global.process.on)) {
if (global.process && global.process.listeners && j$.isFunction_(global.process.on)) {
var originalHandlers = global.process.listeners('uncaughtException');
global.process.removeAllListeners('uncaughtException');
global.process.on('uncaughtException', onerror);