Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metrics-pli/core

Get metrics from a real browser using Puppeteer and Lighthouse
https://github.com/metrics-pli/core

chromeless headless headless-chrome lighthouse performance performance-analysis performance-metrics puppeteer

Last synced: about 2 months ago
JSON representation

Get metrics from a real browser using Puppeteer and Lighthouse

Awesome Lists containing this project

README

        

# Metrics PLI

## Usage

Install via npm

npm i @metrics-pli/core @metrics-pli/types

You need to write your tests like to match the interface `TestInterface`.

An example:

```typescript
import MetricsPli from "@metrics-pli/core";
import { ConfigInterface, TestInterface } from "@metrics-pli/types";

import * as fs from "fs";
import * as path from "path";

const tests: TestInterface[] = [{
name: "Homepage",
url: "https://google.com/",
}];

const config: ConfigInterface = {};

(async () => {
const saveToFilepath = path.resolve(__dirname, "test.json");
const metricsPli = new MetricsPli(tests, config);

metricsPli.on("error", console.error);
metricsPli.on("data", ({ result, test }) => {
// result is of type ResultsetInterface
// test is of type TestInterface
fs.writeFileSync(saveToFilepath, JSON.stringify(result), "utf-8");
});

metricsPli.run();
})();
```

## License

MIT