我有Customer.js.flow
类型的文件。babel-jest转换非.js | .jsx扩展
当我运行的笑话,它失败,此错误:
Customer.js.flow:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export type Customer = {
^^^^^^
SyntaxError: Unexpected token export
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:320:12)
即使我明确地说:
"transform": {
"^.+\\.js.flow$": "babel-jest",
"^.+\\.jsx?$": "babel-jest"
},
,当我改变Customer.js.flow
到Customer.js
我没有问题了
更新我的问题,这不是这个。我原来的解决方案是在这里:https://github.com/facebook/jest/issues/2152#issuecomment-262485964 所以我写了我自己的自定义转换器:https://github.com/MayasHaddad/flow-jest -变压器 – Mayas