fix(env): Throw if nested describe has no children.
Users would like an error if it() is acciddently moved within a before/afterEach/All function. The it() function calls ensureIsNotNested to report such an error. But if the user has no other it() functions in the Suite, it() and thus ensureIsNotNested() is never called. Here we check nested Suites for children; if none are found we throw.
This commit is contained in:
@@ -843,6 +843,9 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
suite.pend();
|
||||
}
|
||||
addSpecsToSuite(suite, specDefinitions);
|
||||
if (suite.parentSuite && !suite.children.length) {
|
||||
throw new Error('describe with no children (describe() or it())');
|
||||
}
|
||||
return suite;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user