TypeError: Illegal invocation when running app tests with jest
See original GitHub issue● Test suite failed to run
TypeError: Illegal invocation
at Node.get [as childNodes] (node_modules/jsdom/lib/jsdom/living/generated/Node.js:423:13)
at Node.get (node_modules/smooth-dnd/dist/index.js:1:15997)
at node_modules/smooth-dnd/dist/index.js:1:15891
at Object.<anonymous> (node_modules/smooth-dnd/dist/index.js:1:16064)
at Object.<anonymous> (node_modules/smooth-dnd/dist/index.js:1:16414)
at n (node_modules/smooth-dnd/dist/index.js:1:358)
at Object.<anonymous> (node_modules/smooth-dnd/dist/index.js:1:16522)
at Object.<anonymous> (node_modules/smooth-dnd/dist/index.js:1:23545)
at n (node_modules/smooth-dnd/dist/index.js:1:358)
at Object.<anonymous> (node_modules/smooth-dnd/dist/index.js:1:23661)
Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
Jest.spyOn Illegal invocation - Stack Overflow
When running npm test , I am getting this Illegal invocation TypeError: Illegal invocation 16 | test("test", async () => { 17 |...
Read more >cypress-io/cypress - Gitter
Error: Uncaught TypeError: Illegal invocation (https://app.listen360.localhost/ ... Hello, is it a well known problem, that when cypress tests are run in ...
Read more >Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >Illegal invocation when trying to focus element in React-Reactjs
import React from "react"; export default function App() { const [activeInput, setActiveInput] = React.useState() if (activeInput) activeInput.el.focus() ...
Read more >Node.js v19.3.0 Documentation
_unrefActive(); DEP0128: modules with an invalid main entry and an index.js ... Mocking; run([options]); test([name][, options][, fn]); describe([name][, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added this to the setup.js and it works:
Mocking the library is a solution if that’s ok to you.
https://jestjs.io/docs/manual-mocks#mocking-node-modules
Solves the problem and as a plus we don’t mess with the environment.