# jest-timing-reporter

> A Jest reporter that collects test execution time into snapshots files as JSON which can be used later with [jest-timing-action](https://github.com/javierfernandes/jest-timing-action).

Latest version **1.0.1** (published 2020-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-timing-reporter
pnpm add jest-timing-reporter
yarn add jest-timing-reporter
bun add jest-timing-reporter
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-05-16 |
| First published | 2020-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 386.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Javier Fernandes |
| Maintainers | jfernandes |
| Keywords | Jest, Reporter, JavaScript |

## Links

- npm: https://www.npmjs.com/package/jest-timing-reporter
- Repository: https://github.com/javierfernandes/jest-timing-reporter
- Homepage: https://github.com/javierfernandes/jest-timing-reporter#readme
- Issues: https://github.com/javierfernandes/jest-timing-reporter/issues
- npm.io page: https://npm.io/package/jest-timing-reporter

## Dependencies (1)

- [ramda](https://npm.io/package/ramda.md) ^0.27.0

## Recent versions

- 1.0.1 (latest) — 2020-05-16
- 1.0.0 — 2020-05-16

## README

# jest-timing-reporter

A Jest reporter that collects test execution time into snapshots files as JSON which can be used later with [jest-timing-action](https://github.com/javierfernandes/jest-timing-action).


# Usage

Install with

```bash
npm i --save-dev jest-timing-reporter
```

or 

```bash
yarn add -D jest-timing-reporter
```

Then edit the jest config in your `package.json` (if that's the case)

```json
{
  "jest": {
    "reporters": [
      "default",
      "jest-timing-reporter"
    ]
  },
}
```

Now you can run `yarn test` or `npm run test` and check that it generated tsnapshot files for each test file.
Make sure you have those files tracked in git.

# Output

It works pretty similar to jest's snapshots. Just that
* it will write snapshots on every run
* it won't check against the previous snapshot at all (that's done by [jest-timing-action](https://github.com/javierfernandes/jest-timing-action) for information purpose when comparing a PR against its base branch)
  
Here is an example folder structure showing the `__tsnapshots__` folder that contains each test file's snapshot

```bash
.
├── LICENSE
├── README.md
├── __tsnapshots__
│   └── index.test.tsnapshot
├── index.js
├── index.test.js
├── package.json
├── some
│   └── more
│       ├── __tsnapshots__
│       │   └── more.test.tsnapshot
│       ├── more.test.js
│       └── tests
│           ├── __tsnapshots__
│           │   └── good.test.tsnapshot
│           └── good.test.js
├── yarn-error.log
└── yarn.lock
```

# Further Work

Currently this is just a small script done as a proof-of-concept to explore jest, GH actions, GH API, etc. plus providing some basic "smoke-test" like information to try to detect changes that impact performance of your code.
For sure this could evolve to a much more useful "continuous code quality measure" solution.

* Handle tests being renamed
* Handle it being moved into a different describe or a new describe
* Handle file moved (remove old file)
* Handle file deleted (remove old file)

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