Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
8.7.0
Detailed description of issue
I am looking to create an instance of the webviewer for some Jest Testing, but it seems to hang when trying to populate. However when using await when creating the WebViewer the test seems to hang indefinately. Any advice or best practices around creating a WebViewer for jest tests?
As far as I can tell apart from using Typescript, I’m not doing anything outside of this to get the error
import WebViewer from '@pdftron/pdfjs-express';
let viewer: WebViewerInstance | null = null;
let instance: any;
beforeAll(async () => {
// Initialize WebViewer instance
instance = await WebViewer({
path: '/webviewer/lib',
initialDoc: '/files/sample.pdf',
});
viewer = instance.Core.documentViewer;
});
// Reset any request handlers that we may add during the tests,
// so they don't affect other tests.
afterEach(() => server.resetHandlers());
// Clean up after the tests are finished.
afterAll(() => {
});