diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 2c1c402b..db08138e 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1309,6 +1309,12 @@ getJasmineRequireObj().Env = function(j$) { * @function */ this.configure = function(configuration) { + if (parallelLoadingState) { + throw new Error( + 'Jasmine cannot be configured via Env in parallel mode' + ); + } + const booleanProps = [ 'random', 'failSpecWithNoExpectations', diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js index 2039fa03..f9f74ef3 100644 --- a/spec/core/EnvSpec.js +++ b/spec/core/EnvSpec.js @@ -758,16 +758,16 @@ describe('Env', function() { describe('In parallel mode', function() { it('rejects if random is set to false', async function() { - env.setParallelLoadingState('specs'); env.configure({ random: false }); + env.setParallelLoadingState('specs'); 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 }); + env.setParallelLoadingState('specs'); await expectAsync(env.execute()).toBeRejectedWithError( 'Random seed cannot be set in parallel mode' ); @@ -817,4 +817,18 @@ describe('Env', function() { }).toThrowError('Reporters cannot be removed via Env in parallel mode'); }); }); + + describe('#configure', function() { + it('throws when called in parallel mode', function() { + env.setParallelLoadingState('helpers'); + expect(function() { + env.configure({}); + }).toThrowError('Jasmine cannot be configured via Env in parallel mode'); + + env.setParallelLoadingState('specs'); + expect(function() { + env.configure({}); + }).toThrowError('Jasmine cannot be configured via Env in parallel mode'); + }); + }); }); diff --git a/src/core/Env.js b/src/core/Env.js index ab5346ea..a942ba4a 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -174,6 +174,12 @@ getJasmineRequireObj().Env = function(j$) { * @function */ this.configure = function(configuration) { + if (parallelLoadingState) { + throw new Error( + 'Jasmine cannot be configured via Env in parallel mode' + ); + } + const booleanProps = [ 'random', 'failSpecWithNoExpectations',