Skip to content

Conversation

@Electroid
Copy link

This PR fixes a bug where there were 2 separate PDFJS objects, and adds support to run tests in Bun.

Thanks for working on this package and happy to help!

@nicolabaesso
Copy link
Contributor

@Electroid I'm a big fan of your work! Unfortunately I cannot take action on this PR, but the code looks good! Also, keeping support for older versions of NodeJs is always a plus.
Last word goes to @modesty

Copy link
Owner

@modesty modesty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for extending the tests and runtime, appreciated.
better to keep bun related info as extension, not replacement. two reasons:

  1. the package should work with or without bun
  2. existing devOp automation is using npm commands, shoud not break

"test": "jest --config ./jest.config.json && npm run parse-r && npm run parse-fd",
"pretest:node": "npm run build",
"test:node": "jest && npm run parse-r && npm run parse-fd",
"pretest:bun": "npm run build",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason to add pretest:bun while unused and same as existing pretest ?
better leave pretest, test as before, and add xxx:bun, so that it'd won't break existing devop automation.

`pretest` step builds bundles and source maps for both ES Module and CommonJS, output to `./dist` directory. The Jest test suit is defined in `./test/_test_.cjs` with commonJS, test run will also cover `parse-r` and `parse-fd` with ES Modules via command line.
```bash
bun run test:bun # runs in Bun
bun run test:node # runs in Node.js using Jest
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better keep npm test as to not breaking existing devop automation.
keep the bun related info as extension, not replacement.

runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node@v18 support is deprecated now

with:
node-version: ${{ matrix.node-version }}

- name: Setup Bun
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need to Setup Bun in node job?

> npm update pdf2json -g
## Usage

To Run in RESTful Web Service or as command line Utility
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of the key feature of pdf2json is to run in a service, this document pointer needs to stay

```

## Test
The module is tested with [Node.js](https://nodejs.org/) 18+ and [Bun](https://bun.sh/) 1+.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lowest supported version of node is 20.x

> npm test
You can run tests in Bun, or in Node.js using Jest.

`pretest` step builds bundles and source maps for both ES Module and CommonJS, output to `./dist` directory. The Jest test suit is defined in `./test/_test_.cjs` with commonJS, test run will also cover `parse-r` and `parse-fd` with ES Modules via command line.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretest is important to get build and test works, it needs to stay

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest.config.json needs to stay, it makes default node env and matching file name convension explicit.

@eric-burel eric-burel mentioned this pull request Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants