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

@@ -138,6 +138,15 @@ getJasmineRequireObj().Env = function(j$) {
* @default true
*/
autoCleanClosures: true,
/**
* Whether to forbid duplicate spec or suite names. If set to true, using
* the same name multiple times in the same immediate parent suite is an
* error.
* @name Configuration#forbidDuplicateNames
* @type boolean
* @default false
*/
forbidDuplicateNames: false,
/**
* Whether or not to issue warnings for certain deprecated functionality
* every time it's used. If not set or set to false, deprecation warnings
@@ -186,7 +195,8 @@ getJasmineRequireObj().Env = function(j$) {
'hideDisabled',
'stopOnSpecFailure',
'stopSpecOnExpectationFailure',
'autoCleanClosures'
'autoCleanClosures',
'forbidDuplicateNames'
];
booleanProps.forEach(function(prop) {