foundation-test-migration
Installation
SKILL.md
Foundation Test Migration
This skill provides guidance on migrating DevTools unit tests to the "foundation" pattern, which is lighter, avoids global singletons, and is compatible with both Node and Browser runtimes (Isomorphic).
Core Concepts
devtools_foundation_module (BUILD.gn)
Use this template for modules that should be platform-agnostic.
- Enforcement: It type-checks the code against both Browser and Node APIs.
- Constraint: Avoid direct DOM access (like
FileReaderor layout metrics) or heavy DevTools dependencies. UseUniverseto access services.
TestUniverse
TestUniverse is the preferred way to setup a DevTools-like environment for tests without global singletons.
- Lazy: Dependencies (targetManager, settings, workspace, etc.) are only created when accessed via getters.
- Scoped: Does not install instances as globals (avoids
Common.Settings.Settings.instance()). - Explicit: Uses
DevToolsContextto manage dependencies.