选项不适用于跑步者

Mak*_*sim 3 testing automation automated-tests e2e-testing testcafe

我正在尝试在隔离模式下运行一个简单的测试:

test.only("test", async t => { await t.expect(true).notOk(); });

这是我的跑步者

const createTestCafe = require("testcafe");

let testcafe = null;

const runTests = (testFiles) => {
const runner = testcafe.createRunner();
  return runner
  .src(testFiles)
  .browsers(["chrome"])
  .run({
    quarantineMode: true
  });
};

createTestCafe("localhost", 1337, 1338)
  .then(tc => {
   testcafe = tc;
   return runTests(["src/tests/"])
})
.then(() => testcafe.close());
Run Code Online (Sandbox Code Playgroud)

但测试仍然只运行一次。我还尝试在我的 package.json 文件附近添加配置文件,并在我的 runner 文件附近添加配置文件,但仍然没有结果。

mlo*_*sev 5

我复制了'run.js'文件中运行TestCafe的代码,然后修改了测试代码如下:

fixture `Fixture`;

test.only("test", async t => {
    console.log('test');
    await t.expect(true).notOk();
});
Run Code Online (Sandbox Code Playgroud)

之后,我node run.js在终端中运行了命令。我得到了以下测试执行报告。

测试执行报告 可以看到这个test词在测试执行报告中出现了3次。因此,测试将运行 3 次,TestCafe 的隔离模式按预期工作。