我有一个非常简单的测试:
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)