如何通过使用 --testNamePattern 运行的 tagName 排除 jest/js 测试?

问题描述 投票:0回答:1

我在 jest/js 中有很多测试。 我想从运行中排除其中一些带有标签 @bug 的代码。

从运行中排除的测试示例:

 test("@bug Sign In - Check Wrong user credentials: status-code 400", async () => { ... });

我尝试运行这个脚本:

npx jest --testNamePattern='^(?!.*@bug).*$' 

但它运行所有测试,并且不排除带有标签@bug的测试。

有人遇到过这样的行为吗?

javascript automation jestjs automated-tests
1个回答
0
投票

可以尝试使用 testpathIgnorePatterns 代替。将使正则表达式更容易https://jestjs.io/docs/configuration#testpathignorepatterns-arraystring

© www.soinside.com 2019 - 2024. All rights reserved.