Optionally enforce uniqueness of spec and suite names

This is off by default for backwards compatibility but can be enabled
by setting the forbidDuplicateNames env config property to true.

Fixes #1633.
This commit is contained in:
Steve Gravrock
2024-11-10 09:32:43 -08:00
parent 744e765d6f
commit d5e7bc9fd6
7 changed files with 233 additions and 2 deletions

View File

@@ -251,6 +251,16 @@ getJasmineRequireObj().Suite = function(j$) {
);
};
Suite.prototype.hasChildWithDescription = function(description) {
for (const child of this.children) {
if (child.description === description) {
return true;
}
}
return false;
};
Object.defineProperty(Suite.prototype, 'metadata', {
get: function() {
if (!this.metadata_) {