dichovsky / pdf-to-png-converter

Library Convert PDF to PNG
MIT License
110 stars 26 forks source link

Segmentation fault in combination wtih `jest` #44

Closed b-fa-ce closed 1 month ago

b-fa-ce commented 5 months ago

Current Behaviour

As far as I can see there is an issue when trying to run the package as part of a jest test which results in a segmentation fault error, SIGSEGV. A minimal example is

import { pdfToPng } from 'pdf-to-png-converter';

export async function convertToPng() {
  const pdfPath = 'test.pdf';
  const pngPath = './test-conversion';

  const options = {
    outputFolder: pngPath,
  };

  await pdfToPng(pdfPath, options);
}

convertToPng();

Running

import { convertToPng } from './testPdfToPng';

describe('example', () => {
  convertToPng();
});

via yarn jest testPdfToPng results in error Command failed with signal "SIGSEGV".

While running it via ts-node path-to/testPdfToPng.ts works fine and converts the pdf.

Environment

dichovsky commented 1 month ago

Jest doesn’t natively support ESM yet, so I use vitest instead