Skip to content

Commit 614e669

Browse files
authored
Integration test dependency fix (#38)
* Remove browserless integration test files Deleted the _test_browserless integration test directory, including its configuration, test script, and package manifest. This cleans up unused or obsolete test code and dependencies. * Update funding, README, and troubleshooting docs Added Tidelift funding link. Improved README by reorganizing and clarifying worker configuration and troubleshooting sections. Enhanced troubleshooting guide with ESM and CJS examples for DOMMatrix errors and fixed a test workflow link.
1 parent cff0ae1 commit 614e669

6 files changed

Lines changed: 24 additions & 99 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
github: mehmet-kozan
2+
tidelift: npm/pdf-parse

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ try {
297297
- **Live Demo:** [`https://mehmet-kozan.github.io/pdf-parse/`](https://mehmet-kozan.github.io/pdf-parse/)
298298
- **Demo Source:** [`reports/demo`](reports/demo)
299299
- **ES Module**: `pdf-parse.es.js` **UMD/Global**: `pdf-parse.umd.js`
300-
- For browser build, set the [`background web worker`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) explicitly.
300+
- For browser build, set the `web worker` explicitly.
301301
302302
### CDN Usage
303303
@@ -332,17 +332,6 @@ try {
332332
- `https://cdn.jsdelivr.net/npm/pdf-parse@latest/dist/pdf-parse/web/pdf.worker.min.mjs`
333333
334334
335-
## Worker Configuration & Troubleshooting
336-
337-
See [docs/troubleshooting.md](./docs/troubleshooting.md) for detailed troubleshooting steps and worker configuration for Node.js and serverless environments.
338-
339-
- Worker setup for Node.js, Next.js, Vercel, AWS Lambda, Netlify, Cloudflare Workers
340-
- Common error messages and solutions
341-
- Manual worker configuration for custom builds and Electron/NW.js
342-
- Node.js version compatibility
343-
344-
If you encounter issues, please refer to the [Troubleshooting Guide](./docs/troubleshooting.md).
345-
346335
## Similar Packages
347336
348337
* [pdf2json](https://www.npmjs.com/package/pdf2json) — Buggy, memory leaks, uncatchable errors in some PDF files.
@@ -366,6 +355,17 @@ Integration tests run on Node.js 20–24, see [`test_integration.yml`](./.github
366355
367356
Requires additional setup see [docs/troubleshooting.md](./docs/troubleshooting.md).
368357
358+
## Worker Configuration & Troubleshooting
359+
360+
See [docs/troubleshooting.md](./docs/troubleshooting.md) for detailed troubleshooting steps and worker configuration for Node.js and serverless environments.
361+
362+
- Worker setup for Node.js, Next.js, Vercel, AWS Lambda, Netlify, Cloudflare Workers.
363+
- Common error messages and solutions.
364+
- Manual worker configuration for custom builds and Electron/NW.js.
365+
- Node.js version compatibility.
366+
367+
If you encounter issues, please refer to the [Troubleshooting Guide](./docs/troubleshooting.md).
368+
369369
## Contributing
370370
371371
When opening an issue, please attach the relevant PDF file if possible. Providing the file will help us reproduce and resolve your issue more efficiently. For detailed guidelines on how to contribute, report bugs, or submit pull requests, see: [`contributing to pdf-parse`](https://github.com/mehmet-kozan/pdf-parse?tab=contributing-ov-file#contributing-to-pdf-parse)

docs/troubleshooting.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This guide provides solutions to common issues encountered when using `pdf-parse
66
## 1. DOMMatrix is not defined
77
This error occurs when DOMMatrix is not available in the Node.js environment. To fix:
88

9+
ESM
910
```js
1011
// Import this before importing "pdf-parse"
1112
import { CanvasFactory } from 'pdf-parse/worker';
@@ -14,6 +15,15 @@ import { PDFParse } from 'pdf-parse';
1415
const parser = new PDFParse({ data: buffer, CanvasFactory });
1516
```
1617

18+
CJS
19+
```js
20+
// Import this before importing "pdf-parse"
21+
const { CanvasFactory } = require ('pdf-parse/worker');
22+
const { PDFParse } = require ('pdf-parse');
23+
24+
const parser = new PDFParse({ data: buffer, CanvasFactory });
25+
```
26+
1727
## 2. Error: require() of ES Module
1828
This happens when trying to require an ES module. Ensure you're using import statements or configure your environment to handle ES modules properly.
1929

@@ -130,7 +140,7 @@ const parser = new PDFParse({ data: buffer, CanvasFactory });
130140
// then use parser
131141
```
132142

133-
Unsupported tests run on Node.js 18, 19, 21, see [`test_integration.yml`](../.github/workflows/test_unsupported.yml).
143+
Unsupported tests run on Node.js 18, 19, 21, see [`test_unsupported.yml`](../.github/workflows/test_unsupported.yml).
134144

135145
## General Advice
136146
- Ensure your deployment platform supports the required Node.js version and dependencies.

tests/integration/_test_browserless/.npmrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/integration/_test_browserless/index.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

tests/integration/_test_browserless/package.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)