Skip to content

l2beat/earl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a220a31 · Nov 6, 2024
Jun 25, 2024
Jun 25, 2024
Jun 10, 2024
Nov 6, 2024
Feb 17, 2021
Apr 21, 2024
Apr 12, 2022
Mar 10, 2023
Apr 21, 2024
Mar 10, 2023
Mar 29, 2023
Apr 21, 2024
Mar 10, 2023
Nov 6, 2024
Nov 6, 2024
Mar 10, 2023
Mar 31, 2023

Repository files navigation

Earl

Ergonomic, modern and type-safe assertion library for TypeScript

Brings good parts of Jest back to good ol' Mocha

Build status Software License

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

npm install --save-dev earl

Example

import { expect } from 'earl'

const user = {
  name: 'John Doe',
  email: 'john@doe.com',
  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

License

Published under the MIT License. Copyright © 2023 L2BEAT.