我正在尝试对现有的 React Native 项目进行测试。当我使用 Jest 运行测试时,测试会出现以下错误:
Test suite failed to run
...etc/__app__/node_modules/react-native/Libraries/polyfills/error-guard.js:14
type ErrorHandler = (error: mixed, isFatal: boolean) => void;
^^^^^^^^^^^^
SyntaxError: Unexpected identifier
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at Object.<anonymous> (node_modules/react-native/jest/setup.js:16:6)
Run Code Online (Sandbox Code Playgroud)
意外的标识符如下:
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict
* @polyfill
*/
let _inGuard = …Run Code Online (Sandbox Code Playgroud) 我似乎完全不了解将babel的根程序选项放在哪里。
如果我有一个monorepo,并且需要告诉不同的子软件包,它们将为babel.config.js向上看,那么我应该将rootMode: "upwards"这些子软件包放入.babelrc中,对吗?由于产生的错误,这不起作用
Error: .rootMode is only allowed in root programmatic options
不知何故,我根本找不到在哪里放置/使用根程序选项的任何示例...有人能指出我正确的方向吗?