Jestjs 应为(…)。toHaveStyleRule不是函数

Jestjs 应为(…)。toHaveStyleRule不是函数,jestjs,emotion,Jestjs,Emotion,我一直试图根据设置jest-enzyme,但jest似乎没有注册jest-enzyme插件 我已经缩写了下面的一些片段 package.json jest.config.js module.exports={ // ... 快照序列化程序:['jest-emotion'], // ... } 我还尝试将它注册到我的setupTests.js文件(与我配置酶的文件相同)中,但没有成功 这是我运行测试时的终端输出 #输出 TypeError:expect(…)。toHaveStyleRule不

我一直试图根据设置
jest-enzyme
,但jest似乎没有注册
jest-enzyme
插件

我已经缩写了下面的一些片段

package.json
jest.config.js
module.exports={
// ...
快照序列化程序:['jest-emotion'],
// ...
}
我还尝试将它注册到我的
setupTests.js
文件(与我配置酶的文件相同)中,但没有成功


这是我运行测试时的终端输出

#输出
TypeError:expect(…)。toHaveStyleRule不是函数
8 | const wrapper=mount();
9 | 
>10 | expect(wrapper).toHaveStyleRule('max-width','192rem');
|                              ^
11 |      });
12 | });
13 | 
在Object.toHaveStyleRule(_测试_/components/layout/container.test.jsx:10:19)

完全忽略了文档中关于
{
  "scripts": {
    "test": "jest"
  },
  "dependencies": {
    "@emotion/core": "^10.0.27",
  },
  "devDependencies": {
    "enzyme": "^3.11.0",
    "jest": "^25.1.0",
    "jest-emotion": "^10.0.27",
  }
}