0.1.0 • Published 9 months ago

@itsmeid/bun-test-utils v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago


📝 Table of Contents

🤔 About

This package offers a set of tools to make your testing easier and boost your development workflow.

  • Easy to use
  • Lightweight
  • Tested

What's inside:

  • Mocking: Create mocks for modules and functions without the hassle.
  • Auto-Mocking: Automatically generate mocks for complex objects to keep your tests clean and
  • Custom Timers: Simulate time in your tests with a fake timer that supports setTimeout and setInterval.
  • Global DOM Control: Manage global DOM settings effortlessly for your web app tests (using @happy-dom/global-registrator).

🔌 Installation

# NPM
npm install --save-dev @itsmeid/bun-test-utils

# BUN
bun add -d @itsmeid/bun-test-utils

⛏️ Built Using

  • Typescript Strongly typed programming language that builds on JavaScript.
  • Bun All-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.

📔 Docs

autoMock

A module that provides functionality to create mocks of target objects for testing purposes. This allows you to easily generate mock implementations with the same shape as the target, making it easier to test interactions with objects without relying on their actual implementations.

globalDOM

A module that manages global DOM settings and operations, allowing for registration, updating, and resetting of global DOM configurations. This module is particularly useful for testing environments that require specific DOM settings. (@happy-dom/global-registrator)

mockModule

A module that provides utilities for mocking other modules in a test environment. This allows you to override specific properties or methods of a module with mock implementations, and manage these mocks easily through compile, restore, and spy functionalities. This is especially useful for testing code that depends on external modules.

timer

A module that provides a fake timer for testing purposes, mimicking the behavior of setTimeout and setInterval. This allows for controlled timing in tests, enabling you to simulate the passage of time without relying on real time delays.