# tinyexpect

> `expect` is a lightweight testing utility with 0 dependencies that provides a Jest-like assertion API for TypeScript/JavaScript projects that use the native Node.js test runner `node --test`.

Latest version **0.7.1** (published 2026-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install tinyexpect
pnpm add tinyexpect
yarn add tinyexpect
bun add tinyexpect
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2026-11-19 |
| First published | 2022-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | crafter999 |
| Maintainers | crafter999 |
| Keywords | expect |

## Links

- npm: https://www.npmjs.com/package/tinyexpect
- Repository: https://github.com/crafter999/tinyexpect
- Homepage: https://github.com/crafter999/tinyexpect#readme
- Issues: https://github.com/crafter999/tinyexpect/issues
- npm.io page: https://npm.io/package/tinyexpect

## Recent versions

- 0.7.1 (latest) — 2026-11-19
- 0.6.2 — 2026-05-18
- 0.6.1 — 2026-05-18
- 0.5.1 — 2024-11-22
- 0.4.1 — 2024-10-13
- 0.3.1 — 2024-10-13
- 0.2.2 — 2024-08-09
- 0.2.1 — 2024-05-07
- 0.1.1 — 2022-05-13

## README

# tinyexpect
 
`expect` is a lightweight testing utility  with 0 dependencies that provides a Jest-like assertion API for TypeScript/JavaScript projects that use the native Node.js test runner `node --test`.

## API Reference

### Matchers

- `toBe(value)`: Checks strict equality (including deep equality for objects)
- `toNotBe(value)`: Checks strict inequality
- `eitherOr(values[])`: Checks if value is included in an array of possible values
- `toBeNumber()`: Verifies value is a number
- `toBeNumberOrParsed()`: Verifies value is either a number or can be parsed as one
- `toBeNumberOr(values[])`: Verifies value is either a number or one of the specified strings
- `toBeFalsy()`: Checks if value is falsy
- `toBeTruthy()`: Checks if value is truthy
- `toBeDefined()`: Verifies value is not undefined
- `toContainString(str)`: Checks if string contains a substring
- `toNotContainString(str)`: Checks if string does not contain a substring
- `toBeSameObject(value)`: Check objects, return true if different property order

### Example
```typescript
import { expect } from "tinyexpect"
expect("test").toBe("test")
```

## Error Handling

All matchers throw descriptive errors when assertions fail, including:
- Detailed error messages for object comparisons
- Type mismatch notifications
- Clear expected vs actual value reporting

## License

MIT

---
_Source: https://npm.io/package/tinyexpect · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
