Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何修复Jest错误:ReferenceError:regeneratorRuntime未定义_Reactjs_Unit Testing_Testing_Jestjs_Enzyme - Fatal编程技术网

Reactjs 如何修复Jest错误:ReferenceError:regeneratorRuntime未定义

Reactjs 如何修复Jest错误:ReferenceError:regeneratorRuntime未定义,reactjs,unit-testing,testing,jestjs,enzyme,Reactjs,Unit Testing,Testing,Jestjs,Enzyme,我在使用React时遇到两个错误: Test suite failed to run ReferenceError: regeneratorRuntime is not defined 18 | export const db = firebaseApp.firestore(); 19 | > 20 | export const generateUserDocument = async (user, additionalData) => {

我在使用React时遇到两个错误:

Test suite failed to run
    ReferenceError: regeneratorRuntime is not defined
      18 | export const db = firebaseApp.firestore();
      19 | 
    > 20 | export const generateUserDocument = async (user, additionalData) => {
         |                                  ^
      21 |     if (!user) return;
      22 | 
      23 |     const userRef = db.doc(`users/${user.uid}`);

Jest遇到了意外的标记

This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.


Details:
SyntaxError:意外的标记“” 导入“./Button.css”

这是我的babelrc文件

{
    "presets": [
        "@babel/env",
        "@babel/react"
    ],
    "plugins": [
        "@babel/plugin-proposal-class-properties"
    ]
}

由于npm运行测试一直失败并显示上述错误消息,我如何修复该问题