Parallel: throw an error if fit/fdescribe are used in parallel mode
This commit is contained in:
@@ -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) {
|
function ensureNonParallelOrInHelperOrInDescribe(method) {
|
||||||
if (parallelLodingState === 'specs' && !suiteBuilder.inDescribe()) {
|
if (parallelLodingState === 'specs' && !suiteBuilder.inDescribe()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1828,6 +1834,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.fdescribe = function(description, definitionFn) {
|
this.fdescribe = function(description, definitionFn) {
|
||||||
ensureIsNotNested('fdescribe');
|
ensureIsNotNested('fdescribe');
|
||||||
|
ensureNonParallel('fdescribe');
|
||||||
return suiteBuilder.fdescribe(description, definitionFn).metadata;
|
return suiteBuilder.fdescribe(description, definitionFn).metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1865,6 +1872,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.fit = function(description, fn, timeout) {
|
this.fit = function(description, fn, timeout) {
|
||||||
ensureIsNotNested('fit');
|
ensureIsNotNested('fit');
|
||||||
|
ensureNonParallel('fit');
|
||||||
return suiteBuilder.fit(description, fn, timeout).metadata;
|
return suiteBuilder.fit(description, fn, timeout).metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,15 @@ describe('Env', function() {
|
|||||||
|
|
||||||
describe('#fdescribe', function() {
|
describe('#fdescribe', function() {
|
||||||
behavesLikeDescribe('fdescribe');
|
behavesLikeDescribe('fdescribe');
|
||||||
|
|
||||||
|
it('throws an error in parallel mode', function() {
|
||||||
|
env.setParallelLoadingState('specs');
|
||||||
|
expect(function() {
|
||||||
|
env.fdescribe('a suite', function() {
|
||||||
|
env.it('a spec');
|
||||||
|
});
|
||||||
|
}).toThrowError("'fdescribe' is not available in parallel mode");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('xdescribe', function() {
|
describe('xdescribe', function() {
|
||||||
@@ -372,6 +381,13 @@ describe('Env', function() {
|
|||||||
env.fit('huge timeout', function() {}, 2147483648);
|
env.fit('huge timeout', function() {}, 2147483648);
|
||||||
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
}).toThrowError('Timeout value cannot be greater than 2147483647');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an error in parallel mode', function() {
|
||||||
|
env.setParallelLoadingState('specs');
|
||||||
|
expect(function() {
|
||||||
|
env.fit('a spec', function() {});
|
||||||
|
}).toThrowError("'fit' is not available in parallel mode");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#beforeEach', function() {
|
describe('#beforeEach', function() {
|
||||||
|
|||||||
@@ -664,6 +664,12 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureNonParallel(method) {
|
||||||
|
if (parallelLodingState) {
|
||||||
|
throw new Error(`'${method}' is not available in parallel mode`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function ensureNonParallelOrInHelperOrInDescribe(method) {
|
function ensureNonParallelOrInHelperOrInDescribe(method) {
|
||||||
if (parallelLodingState === 'specs' && !suiteBuilder.inDescribe()) {
|
if (parallelLodingState === 'specs' && !suiteBuilder.inDescribe()) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -686,6 +692,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.fdescribe = function(description, definitionFn) {
|
this.fdescribe = function(description, definitionFn) {
|
||||||
ensureIsNotNested('fdescribe');
|
ensureIsNotNested('fdescribe');
|
||||||
|
ensureNonParallel('fdescribe');
|
||||||
return suiteBuilder.fdescribe(description, definitionFn).metadata;
|
return suiteBuilder.fdescribe(description, definitionFn).metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -723,6 +730,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
this.fit = function(description, fn, timeout) {
|
this.fit = function(description, fn, timeout) {
|
||||||
ensureIsNotNested('fit');
|
ensureIsNotNested('fit');
|
||||||
|
ensureNonParallel('fit');
|
||||||
return suiteBuilder.fit(description, fn, timeout).metadata;
|
return suiteBuilder.fit(description, fn, timeout).metadata;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user