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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@plyaz/testing

v1.5.5

Published

Comprehensive testing utilities for the Plyaz ecosystem with enhanced Vitest utilities, React testing helpers, mocks, and assertions

Readme

@plyaz/testing

Comprehensive testing utilities for the Plyaz ecosystem

The @plyaz/testing package provides a unified set of testing patterns, mocks, and utilities designed to streamline test writing across React, Next.js, Node.js, and NestJS applications within the Plyaz ecosystem.

🎯 Key Features

  • Unified Testing API: Consistent testing patterns across all frameworks
  • Enhanced Vitest Utilities: Advanced spy management, module mocking, and lifecycle control
  • React Testing Made Easy: Hook testing, component utilities, and provider testing
  • Comprehensive Mocks: HTTP, Node.js, React, and framework-specific mocks
  • Async Testing: Promise control, timing utilities, and retry mechanisms
  • Performance Testing: Benchmarking and performance measurement tools

� Quick Start

import {
  // Core utilities
  expectObject, expectArray, expectPromise,
  spies, mockData, modules
} from '@plyaz/testing';

// Basic test setup
describe('UserService', () => {
  const mockRepo = spies.create(repository, 'findUser');
  
  it('should find user by id', async () => {
    mockRepo.mockResolvedValue(mockUser);
    const result = await userService.findUser('123');
    expectObject.toHaveShape(result, { id: 'string', name: 'string' });
  });
});

📦 Core Modules

Vitest Utilities

Enhanced Vitest utilities with spy management and module mocking:

import { spies, modules, mockData } from '@plyaz/testing';

const spy = spies.create(service, 'getData');
const { unmock } = modules.mock('./config', () => ({ apiUrl: 'test' }));

React Testing

Comprehensive React testing with hooks and components:

import { expectHookValue, testLoadingStates } from '@plyaz/testing';

const { result } = renderHook(() => useCounter(5));
expectHookValue(result, 'count', 5);

Assertions

Enhanced assertions for complex types and behaviors:

import { expectObject, expectArray, expectPromise } from '@plyaz/testing';

expectObject.toHaveShape(user, { id: 'string', name: 'string' });
expectArray.toContainMatching(users, user => user.isActive);
await expectPromise.toResolveWith(fetchUser('123'), mockUser);

Mocks & Factories

Comprehensive mock creation and management:

import { NodeMocks, HttpMocks, ReactMocks } from '@plyaz/testing';

const fs = NodeMocks.createMockFS({ '/test.txt': 'content' });
const req = HttpMocks.createMockHttpRequest({ method: 'POST' });

🏗️ Framework Support

  • React: Hook testing, component utilities, provider testing
  • Next.js: Pages, API routes, SSR/SSG testing, App Router support
  • Node.js: File system, process, streams, and crypto mocking
  • NestJS: Controllers, services, modules, and dependency injection testing

📚 Documentation

For comprehensive documentation and examples,

Documentation for @plyaz/testing Package API References & Type Definitions - @plyaz/testing [Testing Package

](https://plyaz.atlassian.net/wiki/spaces/SD/pages/43745282/Testing+Package) visit our Testing Package Documentation or the general Confluence Documentation.

Quick links:

  • API Reference: Complete function documentation
  • Testing Patterns: Best practices and common patterns
  • Framework Guides: Specific guides for React, Next.js, Node.js, and NestJS
  • Examples: Real-world testing examples

🧰 Integration

This package integrates seamlessly with:

  • ✅ TypeScript (strict mode)
  • ✅ Vitest testing framework
  • ✅ React Testing Library
  • ✅ ESLint & Prettier via @plyaz/devtools
  • ✅ All Plyaz ecosystem packages

🔧 Installation

npm install --save-dev @plyaz/testing
# or
pnpm add -D @plyaz/testing

🧠 Ownership

This package is maintained by the Plyaz engineering team. It provides the foundation for testing across all Plyaz applications and services.