Okta Sign In Widget Breaks Neutrino Jest TEsts

Hi,

Whenever I use Jest in neutrino test and any of the files include any import of the Okta Sign In Widget, I get an error on import. Tried transformations of the file in the jest babel plugins but it still causes the same error. Neutrino is using an older version of Jest so I have no control over that but has any seen or fixed an issue like this? It works fine in the React application build but only in the test environment does it break. It does not have to even be in the test but just imported by any file that is eventually imported and it is taking down all my unit tests.

    TypeError: Cannot read property 'backingStorePixelRatio' of null
  
  at node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:26506:16
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:26507:2)
  at TRUE (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:24359:209)
  at node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:24363:3
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:27966:3)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:24234:106)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:22994:179)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:22619:33)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:21766:158)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:116:350)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:67:33)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:57:1)
  at __webpack_require__ (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:30:27)
  at node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:50:16
  at node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:51:10
  at webpackUniversalModuleDefinition (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:3:16)
  at Object.<anonymous> (node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.entry.js:10:3)
  at Object.<anonymous> (node_modules/@univex/okta/src/components/okta-sign-in-widget/index.jsx:2:25)
  at Object.<anonymous> (node_modules/@univex/okta/src/decorators/secure-route.jsx:5:151)
  at Object.<anonymous> (node_modules/@univex/okta/src/index.js:3:20)
  at Object.<anonymous> (src/applications/univex-integration/src/routes/create-experiment/index.jsx:5:13)
  at Object.<anonymous> (src/applications/univex-integration/test/routes/create-experiment/index.spec.jsx:10:25)
      at Generator.next (<anonymous>)
      at new Promise (<anonymous>)
  at handle (node_modules/worker-farm/lib/child/index.js:44:8)
  at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:51:3)
  at emitTwo (events.js:126:13)
  at process.emit (events.js:214:7)
  at emit (internal/child_process.js:772:12)
  at _combinedTickCallback (internal/process/next_tick.js:141:11)
  at process._tickCallback (internal/process/next_tick.js:180:9)
1 Like

Well I fixed this. It seems to be a canvas issue and installing the canvas-prebuilt as a dev dependency got rid of the error.

Hi @bmoellers , could I have more information about how you isolated the issue and fixed it?
Thanks!

1 Like

I have this problem and no luck with the solution.

This guy on StackOverflow has the same problem and is building an Angular app (iā€™m writing a React app) and idk how to proceed to try his solution.

https://stackoverflow.com/a/58710104/807037 worked for me for a React app.