Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
jest-pdf-snapshot-thomaschaaf
Advanced tools
=========================== 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)
===============================================================
jest-pdf-snapshot provides Jest matcher that performs pdf comparisons. It uses diff-pdf for pdf comparison/diff.
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.
⚠️ Jest-pdf-snapshot depends on vslavik/diff-pdf. Please read diff-pdf's README.md to install it to your test environment.
After you've set up diff-pdf, you can install jest-pdf-snapshot just with:
npm install --save-dev jest-pdf-snapshot
FAQs
Jest matcher for pdf comparison
We found that jest-pdf-snapshot-thomaschaaf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.