# k6-html-reporter

> A html reporter for k6

Latest version **1.0.5** (published 2021-09-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install k6-html-reporter
pnpm add k6-html-reporter
yarn add k6-html-reporter
bun add k6-html-reporter
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2021-09-18 |
| First published | 2020-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 30.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Maintainers | szboynono |
| Keywords | report, k6, html, json to html, k6 html reporter, k6 summary report |

## Links

- npm: https://www.npmjs.com/package/k6-html-reporter
- Repository: https://github.com/szboynono/k6-html-reporter
- Homepage: https://github.com/szboynono/k6-html-reporter#readme
- Issues: https://github.com/szboynono/k6-html-reporter/issues
- npm.io page: https://npm.io/package/k6-html-reporter

## Dependencies (1)

- [ejs](https://npm.io/package/ejs.md) ^3.1.5

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-09-18
- 1.0.4 — 2021-06-30
- 1.0.3 — 2021-03-07
- 1.0.1 — 2021-03-06
- 1.0.0 — 2021-03-05
- 0.0.6 — 2020-12-19
- 0.0.5 — 2020-12-17
- 0.0.4 — 2020-12-14
- 0.0.3 — 2020-12-14
- 0.0.2 — 2020-12-14
- 0.0.1-BETA — 2020-12-14
- 1.0.0-beta — 2020-12-14

## README

# k6-html-reporter

A light weight html reporter for k6

[![Build Status](https://travis-ci.com/szboynono/k6-html-reporter.svg?branch=main)](https://travis-ci.com/szboynono/k6-html-reporter) [![Generic badge](https://img.shields.io/badge/version-1.0.3-<COLOR>.svg)](https://shields.io/)


## Install
NPM:

``` bash
npm install k6-html-reporter --save-dev
```

YARN:

```bash
yarn add k6-html-reporter --dev
```



## Usage

1. Install the package
2. Create a js/ts file and specify the options:

```js

const reporter = require('k6-html-reporter');

const options = {
        jsonFile: <path-to-json-report>,
        output: <path-to-output-directory>,
    };

reporter.generateSummaryReport(options);
    
```

for typescript

```ts
import {generateSummaryReport} from 'k6-html-reporter';

const options = {
        jsonFile: <path-to-json-report>,
        output: <path-to-output-directory>,
    };

generateSummaryReport(options);
```
3. Output a JSON summary output with the `handleSummary` function provided by k6, [more info](https://k6.io/docs/results-visualization/end-of-test-summary).
```js
export default function () { /** some tests here */}
export function handleSummary(data) {
  console.log('Preparing the end-of-test summary...');
  return {
      <path-to-json-report>: JSON.stringify(data),
  }
}
```

> **Note**: The ` --summary-export=path/to/file.json` run option is no longer recomanded after k6 v0.30.0.

4. Run the code in step two as a node.js script after the test execution:
```bash
node xxxx.js
```

### Sample report:
![Alt text](./screenshot/k6.png?raw=true "Optional Title")

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