Parallel: throw if Env#topSuite is called

This commit is contained in:
Steve Gravrock
2022-10-11 20:16:14 -07:00
parent e14d9c4be3
commit bb497beeff
3 changed files with 15 additions and 0 deletions

View File

@@ -1542,6 +1542,7 @@ getJasmineRequireObj().Env = function(j$) {
* @since 2.0.0
*/
this.topSuite = function() {
ensureNonParallel('topSuite');
return topSuite.metadata;
};

View File

@@ -81,6 +81,19 @@ describe('Env', function() {
);
expect(suite.children[1].children[1].children[0].children).toBeFalsy();
});
it('throws if called in parallel mode', function() {
env.setParallelLoadingState('helpers');
check();
env.setParallelLoadingState('specs');
check();
function check() {
expect(function() {
env.topSuite();
}).toThrowError("'topSuite' is not available in parallel mode");
}
});
});
it('accepts its own current configureation', function() {

View File

@@ -400,6 +400,7 @@ getJasmineRequireObj().Env = function(j$) {
* @since 2.0.0
*/
this.topSuite = function() {
ensureNonParallel('topSuite');
return topSuite.metadata;
};