# jest-performance-testing

> You can use test matchers for react-performance-testing

Latest version **1.0.0** (published 2020-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-performance-testing
pnpm add jest-performance-testing
yarn add jest-performance-testing
bun add jest-performance-testing
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-08-21 |
| First published | 2020-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 289 |
| Author | keiya01 |
| Maintainers | keiya01 |
| Keywords | jest, unit, test, testing |

## Links

- npm: https://www.npmjs.com/package/jest-performance-testing
- Repository: https://github.com/keiya01/react-performance-testing
- Homepage: https://github.com/keiya01/react-performance-testing#readme
- Issues: https://github.com/keiya01/react-performance-testing/issues
- npm.io page: https://npm.io/package/jest-performance-testing

## Dependencies (1)

- [jest-matcher-utils](https://npm.io/package/jest-matcher-utils.md) ^26.4.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-08-21
- 0.0.2 — 2020-08-21
- 0.0.1 — 2020-08-19

## README

# jest-performance-testing

![npm](https://img.shields.io/npm/v/react-performance-testing)
[![codecov](https://codecov.io/gh/keiya01/react-performance-testing/branch/master/graph/badge.svg)](https://codecov.io/gh/keiya01/react-performance-testing)
![GitHub Workflow Status](https://github.com/keiya01/react-performance-testing/workflows/test/badge.svg)
![GitHub Workflow Status](https://github.com/keiya01/react-performance-testing/workflows/build/badge.svg)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

You can get benefit by using this lib with [react-performance-testing](https://github.com/keiya01/react-performance-testing#readme). This lib is created to improve DX for react-performance-test users. You can write test **quickly** and **easy**.

## Table of Contents

- [Installation](#installation)
- [API](#api)
  - [toBeMounted](#toBeMounted)
  - [toBeMountedWithin](#toBeMountedWithin)
  - [toBeUpdatedWithin](#toBeUpdatedWithin)
  - [toBeRenderedTimes](#toBeRenderedTimes)
- [LICENSE](#license)

## Installation

npm:

```sh
npm install --save-dev jest-performance-testing
```

yarn:

```sh
yarn add --dev jest-performance-testing
```

**Note**: If you are using TypeScript, we are recommending to import this lib in local file like `*.test.ts | *.spec.ts`. This is because, we have expanded [jest](https://github.com/facebook/jest) types, so global types are not recognized by some editors if you import this lib in setup file. If you want to import this lib in setup file, please see here [testing-library/jest-dom#123 (comment)](https://github.com/testing-library/jest-dom/issues/123#issuecomment-526518629).

## API

### toBeMounted

`toBeMounted()`

This matcher is to check if component is mounted.

```js
expect(renderCount.current.Component).toBeMounted();
```

You can use `renderTime` as bellow.

```js
expect(renderTime.current.Component).toBeMounted();
```

### toBeMountedWithin

`toBeMountedWithin(mountedTime: number)`

This matcher is to check if mounted time is less than expected time.

```js
expect(renderTime.current.Component).toBeMountedWithin(16); // ms
```

### toBeUpdatedWithin

`toBeUpdatedWithin(updatedTime: number[])`

This matcher is to check if some updated time are less than expected time.

```js
expect(renderTime.current.Component).toBeUpdatedWithin([
  10, // first render
  15, // second render
  20, // third render
]);
```

If you have same render time, you can write as bellow.

```js
// All items are 16ms
expect(renderTime.current.Component).toBeUpdatedWithin(16);
```

### toBeRenderedTimes

`toBeRenderedTimes(renderedTimes: number)`

This matcher is to check if number of renders are equality.

```js
expect(renderCount.current.Component).toBeRenderedTimes(1);
```

## LICENSE

[MIT](LICENSE)

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