Repository navigation
v4.1.0
v4.1.0 (2026-11-05)
Documentation: https://suites.dev/docs
Suites 4.1 adds InjectionJS support through the new @suites/di.injectionjs adapter. Test constructor-injected services with Jest or Vitest, including dependencies identified by InjectionToken. This release also adds adapter-defined token types and preserves token identity in mock overrides and lookups. CommonJS and ESM remain supported.
InjectionJS support: Requires InjectionJS
^2.6.1and supports constructor injection. Contextualinject()calls, including class field initializers, are not supported.
Features
di.injectionjs,unit- Adds automatic discovery of the InjectionJS adapter. Supports class dependencies,
@Inject()with class, nonempty string, symbol, orInjectionTokenidentifiers, andforwardRef()constructor tokens. Staticparametersand loweredctorParametersmetadata are also supported. (#934) - Supports mock implementations, final values, and real class dependencies exposed through
TestBed.sociable(). Exports a/metadatadeclaration entry point for InjectionJS token types. (27c0fdd)
- Adds automatic discovery of the InjectionJS adapter. Supports class dependencies,
core.unit- Preserves object token identity in overrides and lookups. Two
InjectionTokeninstances with the same description remain distinct dependencies. (b7a7971)
- Preserves object token identity in overrides and lookups. Two
unit,doubles.jest,doubles.vitesttypes.di- Custom DI adapters can augment
InjectableIdentifierRegistry<T>to register their own dependency token types. (76ea267)
- Custom DI adapters can augment
Getting Started with InjectionJS
For InjectionJS + Jest:
pnpm add -D @suites/unit @suites/di.injectionjs @suites/doubles.jestYour application must also have injection-js and reflect-metadata installed. Add suites.d.ts to the files included by your test tsconfig:
/// <reference types="@suites/doubles.jest/unit" />
/// <reference types="@suites/di.injectionjs/metadata" />Enable experimentalDecorators and emitDecoratorMetadata, configure your test transformer to emit decorator metadata, and load reflect-metadata before your decorated classes.
For InjectionJS + Vitest, install @suites/doubles.vitest instead of the Jest adapter and use @suites/doubles.vitest/unit for the first reference. Add this setting to your existing Vitest configuration so the test runner and adapter share the same InjectionJS module:
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
server: { deps: { external: ['injection-js'] } },
},
// Keep your existing decorator metadata transformer and test settings.
});See the InjectionJS adapter guide for a complete test example and support boundaries. Suites builds a flat test container; production provider factories, multi-providers, and injector hierarchy rules are not reproduced.
Enhancements
*- Adds packed-package InjectionJS E2E coverage with Jest and Vitest, in CommonJS and ESM, across Node.js 22, 24, and 26. Compatibility checks cover InjectionJS 2.6.1 and the current 2.x release. (9397487)
di.nestjs,di.inversify- Releases version 4.0.1 to consume the updated shared DI types. These patches contain dependency updates only; supported framework versions remain unchanged. (#1104)
Full Changelog: v4.0.0...v4.1.0