- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我试图忽略 Jest 的 testMatch
模式中的特定文件夹。
我在 __tests__
文件夹中进行了测试,我希望能够将文件夹 __config__
放入其中,其中应忽略所有文件。
/__tests__
/__config__
someConfig.jsx
/MyComponent.jsx
/MyComponent.jsx
我在 __tests__
文件夹中的测试将从 __config__
文件夹导入文件,所以我不想用 transformIgnorePatterns
忽略它们.
但如果我不忽略该文件夹,Jest 会尝试在该文件夹中运行并返回错误:
FAIL
src/components/__tests__/__config__/someConfig.jsx
Your test suite must contain at least one test.
我尝试了几种不同的模式,但找不到忽略 __config__
文件夹的方法
testMatch: [
"**/__tests__/!(__config__)/**/*.(js)?(x)", // Doesn't work
"**/__tests__/(**|!__config__)/*.(js)?(x)", // Doesn't work
"**/__tests__/(**|?!__config__)/*.(js)?(x)", // Doesn't work
"**/__tests__/{**,!__config__}/*.(js)?(x)", // Doesn't work
],
知道如何忽略这样的子文件夹吗?
最佳答案
请尝试使用 testPathIgnorePatterns
。
如果测试路径匹配任何模式,它将被跳过。
使用字符串标记来包含项目根目录的路径。
关于javascript - 使用 Jest 忽略 testMatch 中的特定文件夹模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47819927/
我目前正在尝试使用 testMatch 来匹配测试文件: "testMatch": [ "./src/__tests__/*.js", "./src/**/?(*.)(spec
使用以下配置,更改 testMatch cli 选项时,覆盖率报告会中断。我尝试设置 collectCoverageFrom './src/*.js' 选项,但这也没有解决问题。 ./src/sum.
我试图忽略 Jest 的 testMatch 模式中的特定文件夹。 我在 __tests__ 文件夹中进行了测试,我希望能够将文件夹 __config__ 放入其中,其中应忽略所有文件。 /__tes
任何人都可以向我解释 Jest 配置中 testRegex 和 testMatch 之间的区别是什么?( https://jestjs.io/docs/en/configuration ) 我知道我不
为了让 Jest 在现有项目上运行,我已经尝试了几天。我使用简单的测试只是为了证明我可以在编写任何更复杂的东西之前运行测试。 这是我运行 Jest 时的结果: No tests found In
我是一名优秀的程序员,十分优秀!