Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/l2beat/earl
☕ Ergonomic, modern and type-safe assertion library for TypeScript
https://github.com/l2beat/earl
assert assertion-libraries chai jest mocha testing typescript
Last synced: 24 days ago
JSON representation
☕ Ergonomic, modern and type-safe assertion library for TypeScript
- Host: GitHub
- URL: https://github.com/l2beat/earl
- Owner: l2beat
- License: mit
- Created: 2020-05-05T20:00:16.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T07:13:43.000Z (4 months ago)
- Last Synced: 2024-10-09T15:33:24.253Z (27 days ago)
- Topics: assert, assertion-libraries, chai, jest, mocha, testing, typescript
- Language: TypeScript
- Homepage: https://earl.fun/
- Size: 2.22 MB
- Stars: 257
- Watchers: 6
- Forks: 19
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- best-of-crypto - GitHub - 10% open · ⏱️ 21.04.2024): (Smart Contract Platforms)
README
![Earl](https://raw.githubusercontent.com/l2beat/earl/master/gh-cover.png)
Ergonomic, modern and type-safe assertion library for TypeScript
Brings good parts of Jest back to good ol' Mocha
## Features
- 💪 Use advanced assertions that are able to match whole ranges of values
- 🤖 Written in TypeScript with type-safety in mind
- 🎭 Type-safe, fully integrated mocks included
- ☕ Finally a modern assertion library for Mocha
- 📸 Snapshots can be easily created and updated with Earl
- 🔌 Tweak to your needs with plugins## Installation
```sh
npm install --save-dev earl
```## Example
```typescript
import { expect } from 'earl'const user = {
name: 'John Doe',
email: '[email protected]',
notificationCount: 5,
}// This code fails to compile, and TypeScript provides this useful
// error message:
// Property 'notificationCount' is missing in type
// '{ name: string; email: any; }' but required in type 'User'.
expect(user).toEqual({
name: 'John Doe',
email: expect.a(String),
})
```## Docs
- [Getting started](https://earl.fun/introduction/getting-started.html)
- [API reference](https://earl.fun/api/api-reference.html)# License
Published under the MIT License. Copyright © 2023 L2BEAT.