Reactjs 反应:尝试使用src镜像测试/
我想让我的测试镜像src/。我能够运行这些测试,但它们都失败了,错误如下:Reactjs 反应:尝试使用src镜像测试/,reactjs,testing,Reactjs,Testing,我想让我的测试镜像src/。我能够运行这些测试,但它们都失败了,错误如下: /application/src/setup.js:1 ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Enzyme from 'enzyme';
/application/src/setup.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Enzyme from 'enzyme';
^^^^^^
SyntaxError: Cannot use import statement outside a module
我的项目的文件结构如下(\uuuu tests\uuuu/mirrors src/):
我特别不想将我的测试移到src/中,并保持结构不变,非常感谢您的帮助
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
application/
__tests__/
App.test.js
components/
c.test.js
src/
components/
c.js
styles/
App.js
jest.config.js
setup.js