ajbogh / import_loop_flow_bug

Compares a bug in Flowtype regarding import loops to Typescript which does not have the same issue.
0 stars 0 forks source link

Flow fails with "Super expression must either be null or a function, not undefined" #1

Open ajbogh opened 6 years ago

ajbogh commented 6 years ago

When running the test Flowtype fails with the following error, however Typescript passes:

> jest

 FAIL  __tests__/layout-engine.test.js
  ● Test suite failed to run

    TypeError: Super expression must either be null or a function, not undefined

      at _inherits (src/flowtype/none.js:14:113)
      at src/flowtype/none.js:19:3
      at Object.<anonymous> (src/flowtype/none.js:28:2)
      at Object.<anonymous> (src/flowtype/layout-engine-config.js:2:1)
      at Object.<anonymous> (src/flowtype/graph-view.js:2:1)
      at Object.<anonymous> (src/flowtype/layout-engine.js:2:1)
      at Object.<anonymous> (__tests__/layout-engine.test.js:1:1)

 PASS  __tests__/layout-engine.test.ts

Test Suites: 1 failed, 1 passed, 2 total
Tests:       1 passed, 1 total
ajbogh commented 6 years ago

This is an area for discussion.

Known facts:

The flow command without Jest works.

╰─$ flow
Launching Flow server for /Users/ajbogh/Projects/import_loop_flow_bug
Spawned flow server (pid=16980)
Logs will go to /private/tmp/flow/zSUserszSajboghzSProjectszSimport_loop_flow_bug.log
Monitor logs will go to /private/tmp/flow/zSUserszSajboghzSProjectszSimport_loop_flow_bug.monitor_log
No errors!

Flow/Jest uses babel-jest:

"jest": {
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "transform": {
      "^.+\\.(js)$": "babel-jest",
      "^.+\\.(ts|tsx)$": "ts-jest"
    },

Babel uses flow preset in .babelrc:

{
  "presets": [
    "flow",
    "es2015",
    "stage-2"
  ]
}