ReferenceError: Система не определена - PullRequest
0 голосов
/ 28 августа 2018

Я получаю следующую ошибку в своем тесте Jest при попытке проверить файл, который использует System.import().

* Test suite failed to run

ReferenceError: System is not defined

> 1 | System.import('./Foo.jsx');
    | ^
  2 | 

  at Object.<anonymous> (src/Bar.jsx:1:1)
  at Object.<anonymous> (src/__tests__/Bar.test.jsx:1:1)

Вот моя .babelrc конфигурация:

{
  "presets": [
    "react",
    "es2015"
  ],
  "plugins": [
    "transform-exponentiation-operator",
    "transform-object-rest-spread",
    "transform-class-properties",
    "transform-async-to-generator"
  ],
  "env": {
    "test": {
      "plugins": [
          "dynamic-import-node",
          "syntax-dynamic-import"
      ]
    }
  }
}

Я использую следующие пакеты:

"babel-core": "6.26.0",
"babel-jest": "20.0.3",
"babel-plugin-dynamic-import-node": "^2.0.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-dynamic-import": "^2.0.0",
"babel-preset-es2015": "6.24.1",
"babel-preset-react": "6.24.1",

Я просматривал во всем Интернете похожие проблемы, но ничего не помогло:

...