通过grep过滤运行测试不起作用

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

我有以下测试:

test('111', async t => {
    await t.expect(true).ok()
});

test('222', async t => {
    await t.expect(true).ok()
});

我想使用-T , --test-grep模式运行两个测试,但是在Powershell中执行时出现错误:

npx testcafe -T "111|222"

'222' is not recognized as an internal or external command, operable program or batch file.

为什么会这样?我确定我使用的是正确的正则表达式模式。另外我也不想使用测试metadata过滤。

testing automation automated-tests e2e-testing testcafe
1个回答
0
投票

在这种情况下,似乎TestCafe参数解析器无法正确解析grep字符串。请用单引号将grep参数包裹起来,如下所示:

testcafe chrome test.js -T '"111|222"'
© www.soinside.com 2019 - 2024. All rights reserved.