reactjs - 反应:尝试用 src/ 镜像 __tests__/
问题描述
我想让我的 __tests__/ 镜像 src/。我能够运行测试,但它们都失败了,并出现以下相同的错误:
/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
setup.js
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
我的项目的文件结构如下(__tests__/ mirrors src/):
application/
__tests__/
App.test.js
components/
c.test.js
src/
components/
c.js
styles/
App.js
jest.config.js
setup.js
我特别不想将我的 __test__/ 移动到 src/ 并保持结构不变,感谢您的帮助!
解决方案
推荐阅读
- python - 使用延续令牌使用 Python SDK 对 Azure CosmosDB 进行分页
- node.js - Graphql mongodb 无法返回 _id
- asp.net-core - 将 AddMicrosoftIdentityWebApp 与 IdentityServer4 结合使用有什么运气吗?
- mysql - SQL从一行中删除不必要的字符并将一个表解析成一个新表
- javascript - WebGL 3D 透视图
- python - 将 SQL 查询格式化为 Python
- c# - 如何在单独的类中注册多个服务、多个实现并在 ConfigureServices 方法中调用它?
- pandas - 在 groupby 中应用 Size() 函数以及聚合参数 - Pandas
- json - _TypeError(类型'列表
' 不是类型 'Map 的子类型 - html - 如何使用 display:block/none 在子元素上设置父元素的宽度