Jest遇到意外令牌:意外令牌:{

时间:2019-07-22 07:29:02

标签: javascript reactjs selenium enzyme

我开玩笑地进行Selenium测试时遇到问题。每当我尝试运行测试时,都会出现以下错误:

 FAIL  app/tests/master.selenium.js
  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    D:\Workspaces\Refrezh\frontend\internals\testing\enzyme-setup.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { configure } from "enzyme";
                                                                                                    ^

    SyntaxError: Unexpected token {

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)

这很奇怪,因为它突然停止工作并且之前运行良好。

有什么想法吗?

0 个答案:

没有答案