Frontmatter
| id | 8876 |
| title | test: Fix Namespace Collisions in Unit Tests exposed by setupClass Guardrail |
| state | Closed |
| labels | refactoringtestingcore |
| assignees | tobiu |
| createdAt | Jan 24, 2026, 3:25 PM |
| updatedAt | Jan 24, 2026, 4:26 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8876 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 24, 2026, 3:47 PM |
test: Fix Namespace Collisions in Unit Tests exposed by setupClass Guardrail
tobiu assigned to @tobiu on Jan 24, 2026, 3:46 PM

tobiu
Jan 24, 2026, 3:46 PM
Input from Gemini 3 Pro:
✦ I have resolved the namespace collisions in the unit test suite and enabled the new
setupClassguardrail.Implementation Details:
- Hardened
Neo.setupClass: Modifiedsrc/Neo.mjsto throw a specific error (Namespace collision in unitTestMode) when a namespace is redefined whileNeo.config.unitTestModeis true. This ensures strict isolation for unit tests.- Fixed Test Suite Collisions: I identified and renamed colliding class definitions in the following test files to be unique and file-specific:
test/playwright/unit/state/ProviderNestedDataConfigs.spec.mjs:Mock.Component->Test.Unit.State.ProviderNestedDataConfigs.MockComponenttest/playwright/unit/vdom/TreeBuilder.spec.mjs:Test.MockComponent->Test.Unit.Vdom.TreeBuilder.MockComponenttest/playwright/unit/vdom/VdomLifecycle.spec.mjs:Test.MockComponent->Test.Unit.Vdom.VdomLifecycle.MockComponenttest/playwright/unit/vdom/VdomMerging.spec.mjs:Test.Container->Test.Unit.Vdom.VdomMerging.Containertest/playwright/unit/core/ClassConfigsAndFields.spec.mjs:Neo.TestClass->Test.Unit.Core.ClassConfigsAndFields.TestClassand fixedNeo.core.Basecollision.test/playwright/unit/core/ClassSystem.spec.mjs:Neo.TestClass->Test.Unit.Core.ClassSystem.TestClassNote: The
setupClasschange is being committed NOW as part of this PR, effectively activating the guardrail for all future test runs.The full unit test suite now passes with strict namespace enforcement enabled.
tobiu closed this issue on Jan 24, 2026, 3:47 PM
Description: We recently hardened
Neo.setupClassto throw an error whenNeo.config.unitTestModeis true and a namespace collision occurs. This prevents test isolation issues where different tests unintentionally share or overwrite class definitions.This change has exposed existing collisions in our test suite, where multiple test files define classes with generic names like
Mock.ComponentorTest.Container.Goals:
Test.Unit.Vdom.TreeBuilder.MockComponent).Known Failures:
test/playwright/unit/state/ProviderNestedDataConfigs.spec.mjs(Mock.Component)test/playwright/unit/vdom/TreeBuilder.spec.mjs(Test.MockComponent)test/playwright/unit/vdom/VdomLifecycle.spec.mjs(Test.MockComponent)test/playwright/unit/vdom/VdomMerging.spec.mjs(Test.Container)Action Plan: Iterate through the failing tests and rename the test classes to be unique.