Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 1.45 KB

README.md

File metadata and controls

40 lines (24 loc) · 1.45 KB

preact-perf-metrics | example

This minimal preact app (created following these instructions) showcases preact-perf-metrics.

There're two examples, /counters and /items-list, and each has an associated perf-test: /counters, /items-list.

Run the performance tests

To run the performance tests:

  • step into this directory (/example)
  • Install dependencies: npm install
  • Run the application: npm run dev
  • In a different terminal (while de application is running), run the tests: npm run test:perf

Notable details

1- Peformance instrumentation

It happens in the main file using the setup() function from @loveholidays/preact-perf-metrics/setup

2- Playwright configuration

It happens in the playwright config file when doing

import { expect } from '@playwright/test';
import { extension } from '@loveholidays/preact-perf-metrics';
expect.extend(extension);

Note

This can also be done on the test file itself or in another file (see playwright-custom-matchers docs)

3- Playwright tests

The test files under perf-test folder

Note that for each interaction you want to test you need to call reset() before (to reset the counters).