Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.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
Ecmascript 6 使用jest意外标识符创建执行测试的React应用程序_Ecmascript 6_Jestjs_Create React App_Babel Jest - Fatal编程技术网

Ecmascript 6 使用jest意外标识符创建执行测试的React应用程序

Ecmascript 6 使用jest意外标识符创建执行测试的React应用程序,ecmascript-6,jestjs,create-react-app,babel-jest,Ecmascript 6,Jestjs,Create React App,Babel Jest,我试图在CRA中用jest执行测试,我不断地得到这个奇怪的错误 C:\Users\mfonpah\Documents\projects\nexus-web-client\web- client\node_modules\auth0-js\src\index.js:1 (function (exports, require, module, __filename, __dirname) { import Authentication from './authentication';

我试图在CRA中用jest执行测试,我不断地得到这个奇怪的错误

C:\Users\mfonpah\Documents\projects\nexus-web-client\web- 
client\node_modules\auth0-js\src\index.js:1
(function (exports, require, module, __filename, __dirname) { import 
Authentication from './authentication';                                                                     
^^^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:670:28)
at Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Object.require.extensions.(anonymous function) [as .js] 
(C:\Users\mfonpah\Documents\projects\nexus-web-client\web- 
client\node_modules\babel-register\lib\node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
有没有办法解决这个问题?
谢谢

如果您看到此错误,您的EF6导入语句将不会被传输。确保您的babel预设包含“env”

.babelrcpackage.json中的“babel”属性

{
    "presets":["env", "react"]
}
根据您的使用情况,您可能还需要添加
transform-es2015-modules-amd
插件