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

@@ -4444,6 +4444,15 @@ describe('Env integration', function() {
});
});
it('forbids duplicates when forbidDuplicateNames is true', function() {
env.configure({ forbidDuplicateNames: true });
env.it('a spec');
expect(function() {
env.it('a spec');
}).toThrowError('Duplicate spec name "a spec" found in top suite');
});
function browserEventMethods() {
return {
listeners_: { error: [], unhandledrejection: [] },