{"id":17321805,"url":"https://github.com/ekoopmans/pdftest","last_synced_at":"2025-03-27T03:20:58.844Z","repository":{"id":57321594,"uuid":"348751350","full_name":"eKoopmans/pdftest","owner":"eKoopmans","description":"Visual PDF comparison tool.","archived":false,"fork":false,"pushed_at":"2021-07-09T04:00:53.000Z","size":456,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T11:15:38.224Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eKoopmans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-17T15:03:17.000Z","updated_at":"2021-07-09T04:00:57.000Z","dependencies_parsed_at":"2022-08-25T22:41:41.327Z","dependency_job_id":null,"html_url":"https://github.com/eKoopmans/pdftest","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eKoopmans%2Fpdftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eKoopmans%2Fpdftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eKoopmans%2Fpdftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eKoopmans%2Fpdftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eKoopmans","download_url":"https://codeload.github.com/eKoopmans/pdftest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245773353,"owners_count":20669759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T13:39:42.049Z","updated_at":"2025-03-27T03:20:58.817Z","avatar_url":"https://github.com/eKoopmans.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdftest\n\nVisual PDF comparison tool.\n\n## Usage\n\n1. Add `pdftest` to your project using `npm install --save-dev pdftest`.\n2. Run the PDF file server using `pdftest serve` (optionally specifying a port and root folder, e.g. `pdftest serve 3000 ./path/to/pdfs/`).\n3. Import or require `pdftest` in your test files, making sure your tests are being run in a browser (e.g. via `karma`).\n4. Connect `pdftest` to the server using `pdftest.client.api.connect` (e.g. `pdftest.client.api.connect('http://localhost:3000')`).\n5. Use the comparison functions `pdftest.client.compare` and/or `pdftest.client.compareToSnapshot` to compare PDFs.\n\nNote: When using the main browser dist (`pdftest.client.min.js`), you will have access to *only* the client methods, which will be exposed directly on the `pdftest` exposed variable.\nE.g. in the browser, you should invoke `pdftest.api.connect` and `pdftest.compare`, rather than `pdftest.client.api.connect` / `pdftest.client.compare`.\n\n### Running the PDF server with tests\n\nIn most use cases you will need to start the `pdftest` server before running your tests, and end it when the tests are finished. There are several patterns to accomplish this:\n\n1. **`start-server-and-test` (recommended):**\n\n    Install `start-server-and-test` as a dev dependency (`npm i -D start-server-and-test`), then use in your npm scripts:\n\n    ```\n    \"test:serve\": \"pdftest serve 3000\",\n    \"test:run\": \"karma start\",\n    \"test\": \"start-server-and-test test:serve http://localhost:3000 test:run\",\n    ```\n\n2. **`pdftest start` and `pdftest stop`:**\n\n    This option is built-in and requires no extra dependencies - its main disadvantage is that it will not automatically stop the server if something goes wrong. Active processes are tracked in a `data.json` file, which `pdftest stop` references to kill the process. In rare cases this approach could result in \"orphaned\" background processes.\n    \n    To use it in your npm scripts:\n\n    ```\n    \"test\": pdftest start 3000 \u0026\u0026 karma start \u0026\u0026 pdftest stop 3000\",\n    ```\n\n3. **`npm-run-all` and `wait-on`:**\n\n    Install `npm-run-all` and `wait-on` as dev dependencies (`npm i -D npm-run-all wait-on`), then use in your npm scripts:\n\n    ```\n    \"test:serve\": \"pdftest serve 3000\",\n    \"test:run\": \"wait-on http://localhost:3000 \u0026\u0026 karma start\",\n    \"test\": \"npm-run-all --parallel --race test:serve test:run\",\n    ```\n\n4. **Using `\u0026` (not recommended):**\n\n    - You may use `\u0026` to run the server and tests simultaneously, e.g. `pdftest serve 3000 \u0026 karma start`\n    - This requires no additional dependencies, however:\n      - It does not guarantee the server is running before tests start\n      - It does not end the server process when tests finish\n      - It is not supported on Windows\n\nFor more info, see the discussion of options in the [Cypress documentation](https://docs.cypress.io/guides/guides/continuous-integration.html#Boot-your-server).\n\n## Release process\n\n`npm run stage-release [major/minor/patch]`: Bumps the version and creates a release branch to prepare the new release.\n\n`npm run release [tagmessage]`: Builds the release, tags it, and merges it back into master.\n\n`npm publish`: Publishes the current version to npm.\n\nMake sure to define `.env` with environment variables used by [`@sortpark/build-tools`](https://github.com/sortpark/build-tools) - see `.env.sample` for example values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoopmans%2Fpdftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekoopmans%2Fpdftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekoopmans%2Fpdftest/lists"}