Open tarjei opened 6 years ago
Our previous version (and the one I've just added, 3.6.0) have this file a lot smaller in size than your stack trace would indicate, so I'm wondering whether you are testing against the latest version?
Some other example:
TypeError: Illegal invocation
at Window.get [as indexedDB] (node_modules/indexeddbshim/dist/indexeddbshim-node.js:6890:35)
at shim (node_modules/indexeddbshim/dist/indexeddbshim-node.js:6841:16)
at IDBFactory.IDB.shimIndexedDB.__useShim (node_modules/indexeddbshim/dist/indexeddbshim-node.js:6884:17)
at setGlobalVars (node_modules/indexeddbshim/dist/indexeddbshim-node.js:6988:27)
at Object.<anonymous> (jest/testSetup.js:19:1)
at Generator.next (<anonymous>)
at new Promise (<anonymous>)
at Generator.next (<anonymous>)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
I've reproduced (on accident), no clue what's going on.
We are attempting to follow the standardized interfaces precisely, and they are picky about how a property is accessed. What is your exact call to setGlobalVars
?
As we needed a workaround for our own test environment, I put in a hack that checks for a shimNS
on the this
(e.g., window
or global), and if present, it avoids the error. In the next version I think I will define this with config, but for now that might work as a workaround. But I'd still like to know how your Jest testSetup is invoking setGlobalVars
. Thanks!
I just got the same issue with jest. What's the workaround? if any.
Try setting global.shimNS = true
against the code in master
and see if that solves it.
Try setting
global.shimNS = true
against the code inmaster
and see if that solves it.
How do we set this in Jest? I get the same problem when doing a test on react-native expo app.
` import React from 'react'; import renderer from 'react-test-renderer';
import App from './App';
describe('
Hi, I tried to use indeeddbshim with FBs jest, but I got:
TypeError: Illegal invocation
Here's the stacktrace:
at Window.get [as indexedDB] (node_modules/indexeddbshim/dist/indexeddbshim-node.js:11625:33) at shim (node_modules/indexeddbshim/dist/indexeddbshim-node.js:11557:24) at IDBFactory.IDB.shimIndexedDB.__useShim (node_modules/indexeddbshim/dist/indexeddbshim-node.js:11619:21) at setGlobalVars (node_modules/indexeddbshim/dist/indexeddbshim-node.js:11798:35) at Object.<anonymous> (tests/setupTests.js:23:29)
And the testcode: