酶适配器在./~/react-test-renderer/package.json中给出错误

时间:2019-04-22 13:12:14

标签: reactjs unit-testing webpack enzyme karma-mocha

运行业力测试时出现上述错误。这是我的setupTests.js

import EnzymeAdapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });

Enzyme.configure({
    adapter: new EnzymeAdapter(),
    disableLifecycleMethods: true
});

 var context = require.context(".", true, /_test$/);
 context.keys().forEach(context);

我收到以下错误

ERROR in ./~/react-test-renderer/package.json
Module parse failed: /Users/user/React/prj/react-project/node_modules/react-test-renderer/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.

我遵循Alternative Usage来配置我的业力测试运行程序。我将问题缩小为导入EnzymeAdapter。有人遇到过这个问题吗?

0 个答案:

没有答案