Jest: TypeError: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'.

Created on 9 Jan 2018  路  3Comments  路  Source: facebook/jest

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
Exception: Failed to execute 'dispatchEvent' on 'EventTarget': parameter 1 is not of type 'Event'

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

  • clone the https://github.com/aneldev/dyna-ui-input it is a small react component
  • npm install
  • npm test

  • you can run a demo with npm start (to see that it builds and works)

What is the expected behavior?
To run the test without TypeError

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

node 8.9.1
system: Ubuntu shell under win10

Most helpful comment

@dennisat Removing import 'jsdom-global/register' from index.spec.tsx should fix this one. I am looking into the root cause of the issue 馃憤

All 3 comments

@dennisat Removing import 'jsdom-global/register' from index.spec.tsx should fix this one. I am looking into the root cause of the issue 馃憤

We put jsdom in the environment for you (as long as you use jest-environment-jsdom, which is the default), usage of jsdom-global is not needed

Many thanks guys!

Was this page helpful?
0 / 5 - 0 ratings