-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust on stream #60
base: master
Are you sure you want to change the base?
Adjust on stream #60
Conversation
Prevent gulp stops execution when test abort. New option: abortOnFailure(bool).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
I would be glad if you also update the README.
if (code) { | ||
stream.emit('error', new PluginError(PLUGIN_NAME, 'nightwatch exited with code ' + code)); | ||
} else { | ||
stream.emit('end'); | ||
} | ||
} else { | ||
stream.emit('end'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when stream
is undefined
, calling stream.emit
fails.
How about the following code:
if (stream) {
if (options.abortOnFailure) {
stream.emit('end');
} else if (code) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'nightwatch exited with code ' + code));
} else {
stream.emit('end');
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, I did the reverse.
False by default, it issues End of Error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the above code I wrote is wrong...
The below code is a correct example:
if (stream) {
if (code && options.abortOnFailure) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'nightwatch exited with code ' + code));
} else {
stream.emit('end');
}
}
I think when stream is undefined, calling stream.emit fails.
I care about that if options.abortOnFailure
is true
and stream
is undefined
at the line 37 condition, Uncaught TypeError: Cannot read property 'emit' of undefined
occurs at the line 44.
Lines 37 to 45 in dddef70
if(options.abortOnFailure === true && stream) { | |
if (code) { | |
stream.emit('error', new PluginError(PLUGIN_NAME, 'nightwatch exited with code ' + code)); | |
} else { | |
stream.emit('end'); | |
} | |
} else { | |
stream.emit('end'); | |
} |
Prevent gulp stops execution when test abort. New option: abortOnFailure(bool).