我是第一个使用玩笑的本机测试,这是错误
失败测试 /app.test.js ●测试套件无法运行
SyntaxError: /Users/joyce/Projects/MamaOpe/mobileapp/node_modules/react-native/Libraries/polyfills/error-guard.js: Unexpected token, expected ";" (14:5)
12 | let _inGuard = 0;
13 |
> 14 | type ErrorHandler = (error: mixed, isFatal: boolean) => void;
| ^
15 | type Fn<Args, Return> = (...Args) => Return;
16 |
17 | /**
at Parser._raise (node_modules/@babel/parser/lib/index.js:742:17)
at Parser.raiseWithData (node_modules/@babel/parser/lib/index.js:735:17)
at Parser.raise (node_modules/@babel/parser/lib/index.js:729:17)
at Parser.unexpected (node_modules/@babel/parser/lib/index.js:8779:16)
at Parser.semicolon (node_modules/@babel/parser/lib/index.js:8761:40)
at Parser.parseExpressionStatement (node_modules/@babel/parser/lib/index.js:11637:10)
at Parser.parseStatementContent (node_modules/@babel/parser/lib/index.js:11238:19)
at Parser.parseStatement (node_modules/@babel/parser/lib/index.js:11104:17)
at Parser.parseBlockOrModuleBlockBody (node_modules/@babel/parser/lib/index.js:11679:25)
at Parser.parseBlockBody (node_modules/@babel/parser/lib/index.js:11665:10)
这是我的babel.config.js
module.exports = {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-proposal-class-properties'],
};
这是我的jest.config.js
module.exports = {
preset: 'react-native',
moduleFileExtensions: ['js', 'jsx', 'json', 'node'],
transformIgnorePatterns: [
'node_modules/(?!(jest-)?react-native)',
'node_modules/?!(react-navigation)',
],
};
我在做什么错?该应用程序是使用react native cli not expo构建的
答案 0 :(得分:0)
我知道这很旧,但是我遇到了这个问题,因为我不在根目录中,所以运行jest会给出错误的结果。