Move invalid order exception throw into TreeProcessor
This commit is contained in:
@@ -9523,12 +9523,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
return !config.specFilter(spec);
|
return !config.specFilter(spec);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
processor.processTree();
|
||||||
if (!processor.processTree().valid) {
|
|
||||||
throw new Error(
|
|
||||||
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.#execute2(runablesToRun, order, processor);
|
return this.#execute2(runablesToRun, order, processor);
|
||||||
}
|
}
|
||||||
@@ -11358,7 +11353,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.#stats.valid) {
|
if (!this.#stats.valid) {
|
||||||
throw 'invalid order';
|
throw new Error('invalid order');
|
||||||
}
|
}
|
||||||
|
|
||||||
const childFns = this.#wrapChildren(this.#tree, 0);
|
const childFns = this.#wrapChildren(this.#tree, 0);
|
||||||
@@ -11439,6 +11434,9 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
this.#stats[node.id].segments.length > 1
|
this.#stats[node.id].segments.length > 1
|
||||||
) {
|
) {
|
||||||
this.#stats = { valid: false };
|
this.#stats = { valid: false };
|
||||||
|
throw new Error(
|
||||||
|
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ describe('TreeProcessor', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('marks the run order invalid if it would re-enter a node that does not allow re-entry', function() {
|
it('marks the run order invalid if it would re-enter a node that does not allow re-entry', async function() {
|
||||||
const leaf1 = new Leaf(),
|
const leaf1 = new Leaf(),
|
||||||
leaf2 = new Leaf(),
|
leaf2 = new Leaf(),
|
||||||
leaf3 = new Leaf(),
|
leaf3 = new Leaf(),
|
||||||
@@ -226,10 +226,18 @@ describe('TreeProcessor', function() {
|
|||||||
processor = new jasmineUnderTest.TreeProcessor({
|
processor = new jasmineUnderTest.TreeProcessor({
|
||||||
tree: root,
|
tree: root,
|
||||||
runnableIds: [leaf1.id, leaf3.id, leaf2.id]
|
runnableIds: [leaf1.id, leaf3.id, leaf2.id]
|
||||||
}),
|
});
|
||||||
result = processor.processTree();
|
|
||||||
|
|
||||||
expect(result).toEqual({ valid: false });
|
expect(function() {
|
||||||
|
processor.processTree();
|
||||||
|
}).toThrowError(
|
||||||
|
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Subsequent attempts to execute should fail
|
||||||
|
await expectAsync(processor.execute()).toBeRejectedWithError(
|
||||||
|
'invalid order'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('marks the run order valid if a node being re-entered allows re-entry', function() {
|
it('marks the run order valid if a node being re-entered allows re-entry', function() {
|
||||||
|
|||||||
+1
-6
@@ -122,12 +122,7 @@ getJasmineRequireObj().Runner = function(j$) {
|
|||||||
return !config.specFilter(spec);
|
return !config.specFilter(spec);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
processor.processTree();
|
||||||
if (!processor.processTree().valid) {
|
|
||||||
throw new Error(
|
|
||||||
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.#execute2(runablesToRun, order, processor);
|
return this.#execute2(runablesToRun, order, processor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.#stats.valid) {
|
if (!this.#stats.valid) {
|
||||||
throw 'invalid order';
|
throw new Error('invalid order');
|
||||||
}
|
}
|
||||||
|
|
||||||
const childFns = this.#wrapChildren(this.#tree, 0);
|
const childFns = this.#wrapChildren(this.#tree, 0);
|
||||||
@@ -133,6 +133,9 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
this.#stats[node.id].segments.length > 1
|
this.#stats[node.id].segments.length > 1
|
||||||
) {
|
) {
|
||||||
this.#stats = { valid: false };
|
this.#stats = { valid: false };
|
||||||
|
throw new Error(
|
||||||
|
'Invalid order: would cause a beforeAll or afterAll to be run multiple times'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user