【问题标题】:Running tests by filtering with grep not working通过使用 grep 过滤运行测试不起作用
【发布时间】:2020-06-16 21:53:03
【问题描述】:

我有以下测试:

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】:

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

    testcafe chrome test.js -T '"111|222"'
    

    【讨论】:

    【解决方案2】:

    我看了一下这个问题https://github.com/DevExpress/testcafe/issues/4615 看起来 npx 在正则表达式解析和 -T 参数方面存在问题。

    我执行了node_modules\.bin\testcafe --test-grep '111|222',它成功了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-12
      • 1970-01-01
      • 2019-05-07
      • 2021-09-14
      • 1970-01-01
      • 1970-01-01
      • 2016-09-19
      相关资源
      最近更新 更多