@testing-library/react run jest TypeError: (0 , _dom.configure) is not a function
shashaMF opened this issue · comments
Similar report here, perhaps it can help?
#1055
Suggests it may be something to do with your jest moduleNameMapper
config.
@shashaMF Can you please share a reproduction repo using https://testing-library.com/new-rtl? At the moment we can't help because a screenshot doesn't help us a lot.
Also, you probably don't need to install @testing-library/dom
because it comes bundled in with @testing-library/react
.
@shashaMF您能否使用https://testing-library.com/new-rtl分享复制存储库?目前我们无能为力,因为屏幕截图对我们没有多大帮助。 另外,您可能不需要安装,
@testing-library/dom
因为它与@testing-library/react
.
Sorry, we are an internal data system and do not have an external address.
I see that the @ testing library/react code doesn't seem to recognize this way of writing:
I have never seen this function writing method before。
Can I uninstall @ testing library/dom。
Please share your jest config file and we'll try to help. It's written this way because the code is transpiled.
a wild guess... try changing this line
"config": "<rootDir>/src/config"
to
"^config$": "<rootDir>/src/config"
a wild guess... try changing this line
"config": "<rootDir>/src/config"
to"^config$": "<rootDir>/src/config"
Thank you, it is indeed the previous issue caused by config here. I have already removed it.
I want to ask you, Jest doesn't support the styled components notation. How did you solve it?
for example:
import { Wrapper } from './styled';
return ( <Wrapper> ..... </Wrapper>
This way, Jest will report an error
If you have time, please help me take a look. Thank you very much!
@shashaMF these kind of questions are better asked in stackoverflow or in our discord server.
I'm closing this since there's no problem in RTL.
Thank you.
@shashaMF these kind of questions are better asked in stackoverflow or in our discord server. I'm closing this since there's no problem in RTL. Thank you.
My problem has been solved. It was caused by a configuration in my Jest configuration. Thanks!