Parallel: fail if randomization is disabled or a seed is specified
This commit is contained in:
@@ -1674,6 +1674,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
*/
|
*/
|
||||||
this.execute = async function(runablesToRun) {
|
this.execute = async function(runablesToRun) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
|
if (parallelLoadingState) {
|
||||||
|
validateConfigForParallel();
|
||||||
|
}
|
||||||
|
|
||||||
return runner.execute(runablesToRun);
|
return runner.execute(runablesToRun);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1831,6 +1836,16 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateConfigForParallel() {
|
||||||
|
if (!config.random) {
|
||||||
|
throw new Error('Randomization cannot be disabled in parallel mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.seed !== null && config.seed !== undefined) {
|
||||||
|
throw new Error('Random seed cannot be set in parallel mode');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.describe = function(description, definitionFn) {
|
this.describe = function(description, definitionFn) {
|
||||||
ensureIsNotNested('describe');
|
ensureIsNotNested('describe');
|
||||||
return suiteBuilder.describe(description, definitionFn).metadata;
|
return suiteBuilder.describe(description, definitionFn).metadata;
|
||||||
|
|||||||
@@ -752,6 +752,24 @@ describe('Env', function() {
|
|||||||
await env.execute();
|
await env.execute();
|
||||||
expect(jasmineUnderTest.Suite.prototype.reset).not.toHaveBeenCalled();
|
expect(jasmineUnderTest.Suite.prototype.reset).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('In parallel mode', function() {
|
||||||
|
it('rejects if random is set to false', async function() {
|
||||||
|
env.setParallelLoadingState('specs');
|
||||||
|
env.configure({ random: false });
|
||||||
|
await expectAsync(env.execute()).toBeRejectedWithError(
|
||||||
|
'Randomization cannot be disabled in parallel mode'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects if seed is set', async function() {
|
||||||
|
env.setParallelLoadingState('specs');
|
||||||
|
env.configure({ seed: 1234 });
|
||||||
|
await expectAsync(env.execute()).toBeRejectedWithError(
|
||||||
|
'Random seed cannot be set in parallel mode'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#spyOnGlobalErrorsAsync', function() {
|
describe('#spyOnGlobalErrorsAsync', function() {
|
||||||
|
|||||||
@@ -532,6 +532,11 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
*/
|
*/
|
||||||
this.execute = async function(runablesToRun) {
|
this.execute = async function(runablesToRun) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
|
|
||||||
|
if (parallelLoadingState) {
|
||||||
|
validateConfigForParallel();
|
||||||
|
}
|
||||||
|
|
||||||
return runner.execute(runablesToRun);
|
return runner.execute(runablesToRun);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -689,6 +694,16 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function validateConfigForParallel() {
|
||||||
|
if (!config.random) {
|
||||||
|
throw new Error('Randomization cannot be disabled in parallel mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.seed !== null && config.seed !== undefined) {
|
||||||
|
throw new Error('Random seed cannot be set in parallel mode');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.describe = function(description, definitionFn) {
|
this.describe = function(description, definitionFn) {
|
||||||
ensureIsNotNested('describe');
|
ensureIsNotNested('describe');
|
||||||
return suiteBuilder.describe(description, definitionFn).metadata;
|
return suiteBuilder.describe(description, definitionFn).metadata;
|
||||||
|
|||||||
Reference in New Issue
Block a user