# jest-pdf-snapshot

> Jest matcher for pdf comparison

Latest version **0.5.4** (published 2020-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-pdf-snapshot
pnpm add jest-pdf-snapshot
yarn add jest-pdf-snapshot
bun add jest-pdf-snapshot
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.4 |
| Published | 2020-08-06 |
| First published | 2020-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 172.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Yuito Murase |
| Maintainers | zeptometer |

## Links

- npm: https://www.npmjs.com/package/jest-pdf-snapshot
- Repository: https://github.com/zeptometer/jest-pdf-snapshot
- npm.io page: https://npm.io/package/jest-pdf-snapshot

## Dependencies (4)

- [tmp](https://npm.io/package/tmp.md) ^0.2.1
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4

## Recent versions

- 0.5.4 (latest) — 2020-08-06
- 0.5.3 — 2020-07-30
- 0.5.2 — 2020-06-21
- 0.5.1 — 2020-06-21
- 0.5.0 — 2020-06-21

## README

=========================== CAUTION ===========================
    All contents in this repository are still under development.
    APIs are quite unstable and subject to change.
    It is possible that there are many bugs in the implementation.
    We assume the users are able to fix issues by theirselves in case of trouble.
    (Any contribution is welcome)
    ===============================================================

[![npm version](https://badge.fury.io/js/jest-pdf-snapshot.svg)](https://badge.fury.io/js/jest-pdf-snapshot)

# jest-pdf-snapshot
*jest-pdf-snapshot* provides Jest matcher that performs pdf comparisons. It uses [diff-pdf](https://vslavik.github.io/diff-pdf/) for pdf comparison/diff.

```javascript
const { toMatchPdfSnapshot } = require('jest-pdf-snapshot');

expect.extend({ toMatchPdfSnapshot });

test('Snapshot matches', () => {
  const pdf = fs.readFileSync('../resources/test1.pdf');
  expect(pdf).toMatchPdfSnapshot();
});
```

Would give you following files:

```
├── resources/test1.pdf
└── __tests__
    ├── pdf_snapshots
    │   ├── __diff_output__
    |   |   └── pdf-snapshot-test-js-snapshot-is-different-1-diff.pdf
    |   |        (in case snapshot doesn't match)
    │   └── pdf-snapshot-test-js-snapshot-matches-1.pdf
    └── pdf-snapshot.test.js
```

If you want to play with working example, see our mock project in `__tests__/mock_project`, which we use for integration tests.

## Installation
⚠️ Jest-pdf-snapshot depends on [vslavik/diff-pdf](https://github.com/vslavik/diff-pdf). Please read [diff-pdf's README.md](https://github.com/vslavik/diff-pdf/blob/master/README.md#obtaining-the-binaries) to install it to your test environment.

After you've set up diff-pdf, you can install jest-pdf-snapshot just with:

```shell
npm install --save-dev jest-pdf-snapshot
```

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