这是用react-screenshot-test编写react-screenshot-test : 您所需要做的就是安装react-screenshot-test并配置Jest: // jest.screenshot.config.js module . exports = { testEnvironment : "node" , globalSetup : "react-screenshot-test/global-setup" , globalTeardown : "react-screenshot-test/global-teardown" , testMatch :