dichovsky / pdf-to-png-converter

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

Segmentation fault in combination wtih `jest` #44

Closed b-fa-ce closed 2 months ago

b-fa-ce commented 7 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 2 months ago

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