在 userEvent 上找不到 setup()

Cant find setup() on userEvent

我正尝试按照此处所述在测试库中使用用户事件实用程序:

https://testing-library.com/docs/user-event/intro

不幸的是,当我尝试调用设置函数时

userEvent.setup()

我的IDE说找不到:

为什么会这样?

我在文件中的导入如下所示:

import userEvent from '@testing-library/user-event'

我的包依赖项如下所示:

"@testing-library/dom": "^8.11.3",
"@testing-library/jest-dom": "5.7.0",
"@testing-library/react": "^12.1.2",
"@testing-library/react-hooks": "^7.0.2",
"@testing-library/user-event": "^13.5.0",

v14.0.0

中添加了userEvent.setup()API

文档中有注释user-event/intro

These docs describe user-event@14.