Javascript 如何整合流程和笑话?

Javascript 如何整合流程和笑话?,javascript,frontend,flowtype,jestjs,Javascript,Frontend,Flowtype,Jestjs,我想人们很少一起使用Jest和Flow,但Jest似乎不识别Flow的键入标记 当我运行jest时,我收到错误提示: FAIL __tests__/components/Ui/CheckboxWithLabel.test.js ● Test suite failed to run /home/cargobr/Projetos/Estudos/Terminator-React-Starter-Kit/src/app/components/CheckboxWithLabel.js:

我想人们很少一起使用Jest和Flow,但Jest似乎不识别Flow的键入标记

当我运行
jest
时,我收到错误提示:

 FAIL  __tests__/components/Ui/CheckboxWithLabel.test.js
  ● Test suite failed to run

    /home/cargobr/Projetos/Estudos/Terminator-React-Starter-Kit/src/app/components/CheckboxWithLabel.js: Unexpected token (6:12)
        4 | export default class CheckboxWithLabel extends React.Component {
        5 |   state: {isChecked: boolean};
      > 6 |   onChange: function;
          |             ^
        7 |   setState: function;
        8 |   props: {labelOn: boolean, labelOff: boolean};
        9 | 
我刚刚安装了flow-typed和
flow-typed安装jest@20.0.4
,问题依然存在

Parcial package.json eslintrc
我猜这是因为函数应该是函数?(第一个字母大写)

您是否解决了此问题?我遇到了同样的问题。
函数不是有效的javascript。您需要完整的函数定义:
function(){}
{
  "dependencies": {
    "react": "^15.3.2",
    "react-dom": "^15.3.2",
    "react-router-dom": "^4.0.0",
  },
  "devDependencies": {
    "babel-cli": "^6.24.1",
    "babel-core": "^6.24.1",
    "babel-eslint": "^7.1.1",
    "babel-jest": "^20.0.3",
    "babel-loader": "^6.4.1",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-flow": "^6.23.0",
    "babel-preset-react": "^6.24.1",
    "enzyme": "^2.9.1",
    "eslint": "^3.18.0",
    "eslint-plugin-react": "^6.10.0",
    "jest": "^20.0.4",
    "react-addons-test-utils": "^15.6.0",
    "react-test-renderer": "^15.6.1",
    "regenerator-runtime": "^0.10.5",
    "style-loader": "^0.16.1",
    "webpack": "^2.3.3",
    "webpack-dev-server": "^2.4.2"
  },
  "scripts": {
    "start": "webpack-dev-server",
    "test": "jest"
  },
  "jest": {
    "testRegex": "__tests__/components/.*./*.test.js"
  }
}
{
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "parser": "babel-eslint",
  "plugins": [
    "react"
  ],
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "env": {
    "jest": true
  }
}