相关疑难解决方法(0)

如何使用使用 es6 的 node_modules 设置 jest

我有一个非常简单的测试:

describe('sanity', () => {
  it('sanity', () => {
    expect(true).toBeTruthy()
  })
})
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

 FAIL  spec/javascript/sanity_test.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 …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs babeljs babel-jest

6
推荐指数
3
解决办法
5789
查看次数

标签 统计

babel-jest ×1

babeljs ×1

jestjs ×1

reactjs ×1