Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-performance-testing

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-performance-testing

You can use test matchers for react-performance-testing

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
440
increased by23.25%
Maintainers
1
Weekly downloads
 
Created
Source

jest-performance-testing(Experimental)

npm codecov GitHub Workflow Status GitHub Workflow Status License: MIT

You can get benefit by using this lib with react-performance-testing. This lib is created to improve DX for react-performance-test users. You can write test quickly and easy.

Table of Contents

Installation

npm:

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

yarn:

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 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).

API

toBeMounted

toBeMounted()

This matcher is to check if component is mounted.

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

You can use renderTime as bellow.

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

toBeMountedWithin

toBeMountedWithin(mountedTime: number)

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

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.

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.

// 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.

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

LICENSE

MIT

Keywords

FAQs

Package last updated on 21 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc