jestjs - coveragePathIgnorePatterns - 忽略具有特定结尾的文件
问题描述
开玩笑:我试图忽略所有.stories.tsx
以 example结尾的文件SomeFileName.stories.tsx
。像这样在我的- package.json
>*.stories.tsx
里面添加:coveragePathIgnorePatterns
jest
"jest": {
"coveragePathIgnorePatterns": [
...
"*.stories.tsx"
]
}
不幸的是,运行测试将为我的所有测试引发以下错误:
● 测试套件无法运行
SyntaxError: Invalid regular expression: /*.stories.tsx/: Nothing to repeat at String.match (<anonymous>) ...
我需要在里面添加什么才能完成coveragePathIgnorePatterns
这项工作?
解决方案
我从 javascript 中引用我的,以将其排除在我的 package.json 和它自己的文件中,但无论哪种方式,您都可以指定模式而不转义文件名中的句点。双星号用于路径。
"jest": {
"coveragePathIgnorePatterns": [
...
"./**/*.stories.tsx",
"./some_path/**/*.stories.tsx",
"!./**/*.interface.tsx",
]
}
推荐阅读
- php - PHP/FFMPEG - 为什么我的视频转换会导致空文件?
- c# - 如何将存储在 VARBINARY 列中的文件保存到文件夹中?
- python - 两个列表之间的差异大于两个列表中元素数量的差异
- sql - 长SQL子查询麻烦
- typescript - 如何在 TestCafe 中全局处理错误
- reactjs - 反应本机克隆元素正在失去价值参考
- android - RecyclerView中第一个/最后一个可见项目的回调?
- excel - VBA:分配给对象的宏,单击以执行操作时,它会进入代码并触发 - 参数数量错误或属性分配无效
- r - R:我如何交叉引用 data.frames 的差异?
- python - 有状态的双向 LSTM 批量大小问题