相关疑难解决方法(0)

如何阻止我的 React Native 测试对 Node Modules 中的 Flow 类型进行轰炸?

我正在尝试对现有的 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)

javascript meteor jestjs babeljs react-native

15
推荐指数
3
解决办法
5856
查看次数

Babel:根程序选项

我似乎完全不了解将babel的根程序选项放在哪里。

如果我有一个monorepo,并且需要告诉不同的子软件包,它们将为babel.config.js向上看,那么我应该将rootMode: "upwards"这些子软件包放入.babelrc中,对吗?由于产生的错误,这不起作用

Error: .rootMode is only allowed in root programmatic options

不知何故,我根本找不到在哪里放置/使用根程序选项的任何示例...有人能指出我正确的方向吗?

babel monorepo

5
推荐指数
1
解决办法
1027
查看次数

标签 统计

babel ×1

babeljs ×1

javascript ×1

jestjs ×1

meteor ×1

monorepo ×1

react-native ×1