https://github.com/japa/expect
Assertion package built on top of Jest expect
https://github.com/japa/expect
expect plugin
Last synced: about 1 year ago
JSON representation
Assertion package built on top of Jest expect
- Host: GitHub
- URL: https://github.com/japa/expect
- Owner: japa
- License: mit
- Created: 2022-01-28T09:20:49.000Z (over 4 years ago)
- Default Branch: 3.x
- Last Pushed: 2025-05-15T08:56:35.000Z (about 1 year ago)
- Last Synced: 2025-05-15T08:57:18.646Z (about 1 year ago)
- Topics: expect, plugin
- Language: TypeScript
- Homepage: https://japa.dev/docs/plugins/expect
- Size: 326 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @japa/expect
> Assertion library built on top of jest-expect
[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]
An assertion library built on top of [jest-expect](https://jestjs.io/docs/expect).
#### [Complete API documentation](https://japa.dev/docs/plugins/expect)
## Installation
Install the package from the npm registry as follows:
```sh
npm i @japa/expect
```
```sh
yarn add @japa/expect
```
## Usage
You can use the assertion package with the `@japa/runner` as follows.
```ts
import { expect } from '@japa/expect'
import { configure } from '@japa/runner'
configure({
plugins: [expect()]
})
```
Once done, you will be able to access the `expect` property on the test context.
```ts
test('test title', ({ expect }) => {
expect(100).toBeWithinRange(90, 110)
})
```
[github-actions-url]: https://github.com/japa/expect/actions/workflows/checks.yml "github-actions"
[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/expect/checks.yml?style=for-the-badge
[npm-image]: https://img.shields.io/npm/v/@japa/expect.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/expect "npm"
[license-image]: https://img.shields.io/npm/l/@japa/expect?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]: "typescript"