npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@elsikora/cladi-testing

v1.0.2

Published

Testing utilities for ClaDI applications with clean architecture and explicit composition roots.

Readme

ClaDI Testing

Testing-first utilities for applications built with @elsikora/cladi.

@elsikora/cladi-testing keeps test setup explicit and composable while reducing repeated wiring for common test scenarios.

What it solves

  • create a dedicated DI container for each test suite or case
  • compose plain and decorator modules with one helper
  • build deterministic value/factory mocks with typed tokens
  • override providers in-place for scenario-specific tests
  • reset and dispose resources safely between test runs

Installation

npm install -D @elsikora/cladi @elsikora/cladi-testing

Compatibility:

  • @elsikora/cladi-testing requires @elsikora/cladi >= 2.1.0

Documentation

JSDoc quick links

Quick start

import { createModule, createToken } from "@elsikora/cladi";
import { createTestingContainer, mockProvider, overrideProvider, resetTestingContainer } from "@elsikora/cladi-testing";

interface IUserRepository {
	findNameById(id: string): string | undefined;
}

interface IUserService {
	readName(id: string): string;
}

const UserRepositoryToken = createToken<IUserRepository>("UserRepository");
const UserServiceToken = createToken<IUserService>("UserService");

const appModule = createModule({
	exports: [UserServiceToken],
	providers: [
		mockProvider(UserRepositoryToken, { findNameById: () => "Alice" }),
		{
			deps: [UserRepositoryToken],
			provide: UserServiceToken,
			useFactory: (repository: IUserRepository): IUserService => ({
				readName: (id: string): string => repository.findNameById(id) ?? "unknown",
			}),
		},
	],
});

const container = createTestingContainer({
	modules: [appModule],
	shouldValidateOnCreate: true,
});

console.log(container.resolve(UserServiceToken).readName("u1")); // "Alice"

await overrideProvider(container, mockProvider(UserRepositoryToken, { findNameById: () => "Bob" }));

console.log(container.resolve(UserServiceToken).readName("u1")); // "Bob"
await resetTestingContainer(container);

Typical Vitest pattern

import { beforeEach, afterEach, describe, it, expect } from "vitest";
import { createTestingContainer, resetTestingContainer } from "@elsikora/cladi-testing";

let container: ReturnType<typeof createTestingContainer>;

beforeEach(() => {
	container = createTestingContainer({ shouldValidateOnCreate: true });
});

afterEach(async () => {
	await resetTestingContainer(container);
});

describe("my feature", () => {
	it("resolves dependencies", () => {
		expect(container).toBeDefined();
	});
});

API at a glance

  • createTestingContainer(options?) - create and preconfigure a test container.
  • mockProvider(token, valueOrFactory, options?) - build typed value/factory mocks.
  • overrideProvider(container, provider) - replace provider registration for a token.
  • resetTestingContainer(container) - dispose container and resource graph.
  • composeTestingModules(container, modules) - compose plain and decorator modules.

Detailed behavior and signatures:

Architecture

The package follows clean architecture boundaries:

  • domain: contracts, options, and shared types
  • application: provider-building use-case utilities
  • infrastructure: default constants and low-level details
  • presentation: public API used directly in tests

Entrypoint:

  • src/index.ts

Development scripts

  • npm run lint
  • npm run lint:types
  • npm run test:unit
  • npm run test:e2e
  • npm run test:all
  • npm run build

License

MIT