Skip to content

l2beat/earl

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

  • 💪 Powerful validators and matchers
  • 🤖 Type-safe - written in TypeScript and goes well with static analysis
  • 🎭 Builtin support for mocks
  • ☕ Works great with Mocha
  • 📸 Snapshot testing
  • 🔌 Extensible with plugins

Installation

npm install --save-dev earljs

Note: It's earljs not earl!

Example

import { expect } from 'earljs'

// ...

expect(response).toEqual({
  body: { trimmed: true, timestamp: expect.a(String) },
})

Docs

License

Published under the MIT License. Copyright © 2023 L2BEAT.