@ovh-ux/manager-tests-setup
v0.7.0
Published
Manager common tests configuration
Keywords
Readme
@ovh-ux/manager-tests-setup
Shared unit test configuration for OVHcloud Manager apps
Modular, hexagonally-structured test infrastructure layer
Promotes consistency, reuse, and decoupling across 30+ React applications
Overview
@ovh-ux/manager-tests-setup centralizes test configuration (unit, integration, and future test layers) for all OVHcloud Manager apps. It provides:
- A reusable, opinionated
sharedConfigfor unit and integration testing - Exports (
createConfig,mergeConfig,defaultCoverageConfig) to decouple applications from test runner internals - A CLI tool (
manager-test) for seamless test execution—no need to locally install or configure the test runner
The setup follows Hexagonal Architecture principles, ensuring test logic remains isolated from application code and tooling can evolve independently.
Installation
In the OVHcloud Manager monorepo:
yarn add -D @ovh-ux/manager-tests-setupUsage
Each app consumes the shared configuration by combining sharedConfig with local overrides via mergeConfig.
Example: vitest.config.js
import path from 'path';
import {
sharedConfig,
createConfig,
mergeConfig,
defaultCoverageConfig,
} from '@ovh-ux/manager-tests-setup';
export default mergeConfig(
sharedConfig,
createConfig({
test: {
setupFiles: ['./src/setupTests.ts'],
coverage: {
exclude: ['src/specific/setup.ts', ...defaultCoverageConfig.exclude],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
}),
);CLI: manager-test
A unified CLI wrapper for executing tests without requiring per-app test runner dependencies:
yarn manager-testSupported flags:
yarn manager-test run --coverage
yarn manager-test --uiApplications do not need to install
vitest,@vitejs/plugin-react, or@vitest/coverage-v8individually.
Exports API
| Export | Description |
|--------------------------|-----------------------------------------------------------------------------|
| sharedConfig | Base configuration (includes jsdom, React plugin, coverage) |
| createConfig() | Factory to create custom config fragments (wraps defineConfig) |
| mergeConfig() | Merges shared and local config (wraps mergeConfig from Vitest) |
| defaultCoverageConfig | Shared defaults for coverage settings (excludes, reporters, etc.) |
Architectural Principles
This package follows Hexagonal Architecture:
- Ports:
createConfig,mergeConfig,defaultCoverageConfig - Adapters: Vitest, Vite, React plugin
- Applications remain independent of the underlying testing technology except for strongly coupled APIs like
vi.mock,after*, orbefore*.
Benefits
- Centralized maintenance and upgrades
- Consistent test behavior across projects
- Easy future migration (e.g., to
vitest/browseror Jest)
License
BSD-3-Clause
© OVH SAS — for use with any OVHcloud Manager testing needs (unit, integration, etc.)
