Throw a recognizable Error message when fail outside of a spec.
Fixes #1017
This commit is contained in:
@@ -532,6 +532,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.fail = function(error) {
|
||||
if (!currentRunnable()) {
|
||||
throw new Error('\'fail\' was used when there was no current spec, this could be because an asynchronous test timed out');
|
||||
}
|
||||
|
||||
var message = 'Failed';
|
||||
if (error) {
|
||||
message += ': ';
|
||||
|
||||
Reference in New Issue
Block a user