From f08eea1f1090d758e9b2012b36c0dcd6d59838f7 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 30 Apr 2025 11:52:27 +0000 Subject: [PATCH] fix(readme): Improve README documentation --- changelog.md | 13 +++++++++++++ readme.md | 12 +++++++++++- ts/00_commitinfo_data.ts | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 8000205..3e26bc1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,18 @@ # Changelog +## 2025-04-30 - 2.3.1 - fix(readme) +Improve README documentation with detailed 'Why SmartExpect' benefits section + +- Added detailed 'Why SmartExpect' section outlining zero-config async support, modular footprint, enhanced messaging, rich built-in matchers, plugin extensibility, and TypeScript support +- Clarified installation instructions regarding dependency setup +- Updated changelog and commitinfo version to 2.3.1 + +## 2025-04-30 - 2.3.1 - fix(readme) +Improve README documentation with detailed 'Why SmartExpect' benefits section + +- Added a detailed section outlining zero-config async support, modular footprint, enhanced messaging, rich built-in matchers, plugin extensibility, and TypeScript support +- Clarified installation instructions regarding dependency setup + ## 2025-04-30 - 2.3.0 - feat(object-matchers) Add object key matchers: toHaveKeys and toHaveOwnKeys; remove obsolete roadmap plan file diff --git a/readme.md b/readme.md index 142d1a0..c932128 100644 --- a/readme.md +++ b/readme.md @@ -8,9 +8,19 @@ To install `@push.rocks/smartexpect`, use the following command in your terminal ```bash npm install @push.rocks/smartexpect --save ``` - This will add `@push.rocks/smartexpect` to your project's dependencies. Make sure you're inside your project directory before running this command. +## Why SmartExpect? + +SmartExpect is designed to be a minimal, promise-first assertion library with clear, descriptive messaging and easy extensibility: + +- **Zero-config asynchronous support**: chain `.resolves` / `.rejects` directly off `expect()`, add timeouts with `.withTimeout(ms)`, and get clear errors if you mix sync matchers with non-Promises. +- **Lean, modular footprint**: only depends on `fast-deep-equal`, `@push.rocks/smartpromise`, and `@push.rocks/smartdelay`; pure ESM, tree-shakable, works in Node & browser. +- **Better out-of-the-box messaging**: automatic `.not` inversion (e.g. “Expected 5 not to be greater than 3”) and unified “Expected… / Received…” JSON diffs for object/array mismatches. +- **Rich built-in matchers**: numbers (`toBeNaN`, `toBeWithinRange`), objects (`toHaveKeys`, `toHaveOwnKeys`, shorthand `toHaveOwnProperty`), strings/arrays (`toBeEmpty`, `toInclude`, `toHaveLength`), functions (`toThrowErrorMatching`, `toThrowErrorWithMessage`), dates, and more. +- **Plugin-style extensibility**: add custom matchers with `expect.extend({ myMatcher })` without monkey-patching. +- **First-class TypeScript support**: full `.d.ts` declarations, generic types for sync vs async chains, and autocomplete in editors. + ## Usage `@push.rocks/smartexpect` is a TypeScript library designed to manage expectations in your code effectively, improving testing readability and maintainability. Below are various scenarios showcasing how to use this library effectively across both synchronous and asynchronous code paths. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index bdb0e57..79f388e 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartexpect', - version: '2.3.0', + version: '2.3.1', description: 'A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.' }