# jest-pdf-snapshot-thomaschaaf

> Jest matcher for pdf comparison

Latest version **0.6.2** (published 2021-02-02) · MIT license · 0 weekly downloads

## Install

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

## 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.6.2 |
| Published | 2021-02-02 |
| First published | 2021-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 316 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yuito Murase |
| Maintainers | thomaschaaf |

## Links

- npm: https://www.npmjs.com/package/jest-pdf-snapshot-thomaschaaf
- Repository: https://github.com/zeptometer/jest-pdf-snapshot
- Homepage: https://github.com/zeptometer/jest-pdf-snapshot#readme
- Issues: https://github.com/zeptometer/jest-pdf-snapshot/issues
- npm.io page: https://npm.io/package/jest-pdf-snapshot-thomaschaaf

## Dependencies (5)

- [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
- [compare-pdf](https://npm.io/package/compare-pdf.md) ^1.1.4

## Recent versions

- 0.6.2 (latest) — 2021-02-02
- 0.6.1 — 2021-02-01
- 0.6.0 — 2021-02-01

## 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-thomaschaaf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
