Parallel: throw an error if fit/fdescribe are used in parallel mode

This commit is contained in:
Steve Gravrock
2022-10-11 19:35:59 -07:00
parent 1e7b68236b
commit 89e0b35c53
3 changed files with 32 additions and 0 deletions

View File

@@ -1806,6 +1806,12 @@ getJasmineRequireObj().Env = function(j$) {
}
}
function ensureNonParallel(method) {
if (parallelLodingState) {
throw new Error(`'${method}' is not available in parallel mode`);
}
}
function ensureNonParallelOrInHelperOrInDescribe(method) {
if (parallelLodingState === 'specs' && !suiteBuilder.inDescribe()) {
throw new Error(
@@ -1828,6 +1834,7 @@ getJasmineRequireObj().Env = function(j$) {
this.fdescribe = function(description, definitionFn) {
ensureIsNotNested('fdescribe');
ensureNonParallel('fdescribe');
return suiteBuilder.fdescribe(description, definitionFn).metadata;
};
@@ -1865,6 +1872,7 @@ getJasmineRequireObj().Env = function(j$) {
this.fit = function(description, fn, timeout) {
ensureIsNotNested('fit');
ensureNonParallel('fit');
return suiteBuilder.fit(description, fn, timeout).metadata;
};