jestjs - 为什么我使用玩笑得到未知选项“extensionsToTreatAsEsm”
问题描述
从这里的文档看来,我应该能够将以下内容添加到我的 jest 配置extensionsToTreatAsEsm: [".js", ".mjs"],
中。但是当我跑步时,我得到
Unknown option "extensionsToTreatAsEsm" with value [".js", ".mjs"] was found.
This is probably a typing mistake. Fixing it will remove this message.
我在,latest
所以我错过了什么?
解决方案
我得到了同样的错误,似乎它仍然是实验性的,我的构建在 GitHub 上失败了。目前我没有使用本机 ESM 模块配置jest.config.js
extensionsToTreatAsEsm [数组<字符串>]
Jest will run .mjs and .js files with nearest package.json's type field set to module as ECMAScript Modules. If you have any other files that should run with native ESM, you need to specify their file extension here.
Note: Jest's ESM support is still experimental,
推荐阅读
- karate - 是否有可能在空手道中调整 json 输出?
- python - 从 XML 中删除 ns0、ns1、ns2 命名空间 - Python
- python - 根据另一个数据框修改一个数据框的值
- amazon-cloudwatch - AWS CloudWatch 指标警报无法通过 SNS 通知
- javascript - 为什么我添加到数组中的元素替换了我之前添加的元素?
- html - 图像溢出它们的容器
- python - 将 Callable 连接到类
- c# - 如何在单个 Windows 窗体 DataGridViewComboBoxCell 中激活下拉箭头
- objective-c - 在 MacOs 项目上存档时,如何将嵌入式第三方框架复制到用户库/框架文件夹或项目文件夹?
- augmented-reality - 100 次中有 1 次未在 ARSCNView 中显示 SceneKit 对象