Skip to content

TypeError: (0 , _dom.configure) is not a function #1055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonaohana opened this issue Apr 24, 2022 · 8 comments
Closed

TypeError: (0 , _dom.configure) is not a function #1055

jonaohana opened this issue Apr 24, 2022 · 8 comments

Comments

@jonaohana
Copy link

At a loss here, when I stepped through code, _dom is an object with many properties just not configure, version mismatch?
any help would be appreciated.

FAIL src/components/RewardForm/RewardForm.test.tsx
● Test suite failed to run

TypeError: (0 , _dom.configure) is not a function

  1 | import React from 'react';
> 2 | import { screen, render, getByTestId, fireEvent } from '@testing-library/react';
    | ^
  3 | import userEvent from '@testing-library/user-event';
  4 | import { useForm } from 'react-hook-form';
  5 | import '@testing-library/jest-dom';
@MatanBobi
Copy link
Member

Hi @jonaohana, at the moment this report doesn't have enough details for us to try and investigate it.
Please create a codesandbox reproduction of this issue and also state which versions you're currently using so we'll be able to try and help :)
Thanks.

@Cayan
Copy link

Cayan commented May 6, 2022

I have the same issue, I'm testing multiple versions but nothing so far. I'm trying to implement tests on a legacy platform, current versions:

"react": "^17.0.2",
"@testing-library/react": "^12.1.5",
"jest": "^27.0.3",

@MatanBobi
Copy link
Member

Hi @Cayan.. Can you please provide a reproduction? We can't investigate this any further without a reproduction..
Thanks!

@Cayan
Copy link

Cayan commented May 7, 2022

Hi @MatanBobi after a long investigation I was able to fix the problem!

Apparently, a moduleNameMapper for the config key was causing such conflict.

@rstevens354
Copy link

rstevens354 commented May 11, 2022

@Cayan any chance you could share your fix? I have the exact same error caused by the same moduleNameMapper config

@MatanBobi
Copy link
Member

@rstevens354 you can share your moduleNameMapper here and we'll try to help with that :)
Anyways, I'm closing as it looks like this is not an issue with testing-library and the original poster didn't comment back with information, if you think it is, please comment here and we'll re-open.

Thanks @Cayan!

@eps1lon
Copy link
Member

eps1lon commented May 11, 2022

Hi @MatanBobi after a long investigation I was able to fix the problem!

Apparently, a moduleNameMapper for the config key was causing such conflict.

We've had a similar report in the past that was fixed with #1064 (comment)

@shashaMF
Copy link

shashaMF commented Dec 7, 2023

I am also facing the same problem
When I run Jest, an error occurs:

image my package.json is here

{ ... "@testing-library/dom": "9.0.0", "@testing-library/jest-dom": "6.1.5", "@testing-library/react": "12.1.3", "@testing-library/user-event": "^12.1.10", "react": "^17.0.1", }

And my jest config here.
"moduleNameMapper": { "^@/(.*)$": "<rootDir>/src/$1", "^Assets/(.*)$": "<rootDir>/src/assets/$1", "config": "<rootDir>/src/config", "Services": "<rootDir>/src/services", "^Store/(.*)$": "<rootDir>/src/store/$1", "^utils/(.*)$": "<rootDir>/src/utils/$1", "^Pages/(.*)$": "<rootDir>/src/pages/$1", "^Containers/(.*)$": "<rootDir>/src/containers/$1", "^Typings/(.*)$": "<rootDir>/src/typings/$1", "^Layouts/(.*)$": "<rootDir>/src/layouts/$1", "components": "<rootDir>/src/components", "^react-native$": "react-native-web", "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy", "^.+\\.(css|less|scss)$": "identity-obj-proxy", "./styled": "<rootDir>/src/styleMock.js", "antd": "<rootDir>/node_modules/antd/dist/antd.min.js", "^@ant-design/(.*)$": "<rootDir>/node_modules/@ant-design/$1/dist/index.umd.min.js" }
Very anxious. If anyone knows how to solve it, please let me know. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants