Reset the env state between parallel batches

This commit is contained in:
Steve Gravrock
2022-07-29 08:34:49 -07:00
parent fcbab02b2d
commit 3a43871901
8 changed files with 203 additions and 2 deletions

View File

@@ -499,6 +499,11 @@ getJasmineRequireObj().Env = function(j$) {
reportSpecDone
});
this.parallelReset = function() {
// TODO: ensure that autoCleanClosures was false
suiteBuilder.parallelReset();
};
/**
* Executes the specs.
*

View File

@@ -2,6 +2,7 @@ getJasmineRequireObj().Runner = function(j$) {
class Runner {
constructor(options) {
this.topSuite_ = options.topSuite;
// TODO use names that read like getters
this.totalSpecsDefined_ = options.totalSpecsDefined;
this.focusedRunables_ = options.focusedRunables;
this.runableResources_ = options.runableResources;

View File

@@ -132,6 +132,10 @@ getJasmineRequireObj().Suite = function(j$) {
this.reportedDone = false;
};
Suite.prototype.removeChildren = function() {
this.children = [];
};
Suite.prototype.addChild = function(child) {
this.children.push(child);
};

View File

@@ -22,6 +22,12 @@ getJasmineRequireObj().SuiteBuilder = function(j$) {
this.focusedRunables = [];
}
parallelReset() {
this.topSuite.removeChildren();
this.totalSpecsDefined = 0;
this.focusedRunables = [];
}
describe(description, definitionFn) {
ensureIsFunction(definitionFn, 'describe');
const suite = this.suiteFactory_(description);