pdf/renderer jest ReferenceError: _a is not defined

365 Views Asked by At

I am using @react-pdf/renderer package to generate and download a PDF. Everything is working fine, except when I run my tests using jest it is throwing above error for all the existing test cases. I haven't implemented any test for the PDF component itself. The error looks like below:

A "jest.config.js" override is not configured for the project. Using default configuration.

  • Test suit failed to run

ReferenceError: _a is not defined

    > 247 |  */o.infinity=1e4,o.glue=function(e,t,n,r){return{type:"glue",value:t,width:e,stretch:n,shrink:r}},o.box.....

 at n (../abc/dist/abc.bundle.js:1:2177)
      at Module.call (../abc/dist/abc.bundle.js:272:117795)
      at n (../abc/dist/abc.bundle.js:1:2177)
      at ../abc/dist/abc.bundle.js:1:2976
      at t (../abc/dist/abc.bundle.js:1:2069)
      at ../abc/dist/abc.bundle.js:1:81
      at Object.<anonymous> (../abc/dist/abc.bundle.js:1:2)
      at Object.<anonymous> (src/redux/rootReducer.js:9:1)
      at Object.<anonymous> (src/redux/store.js:20:1)

And such binary is getting printed on console for every existing test file.

Tried below solution...

In the .babelrc file at the root of project added the following:

"ignore": [ "node_modules/yoga-layout-prebuilt" ]

Many thanks in advance!

0

There are 0 best solutions below