Maksim
Maksim

Reputation: 260

Options doesn't apply to runner

I'm trying to run a simple test in quarantine mode:

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

Here is my runner

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());

But the test still runs only for one time. I also tried to add config file near with my package.json file and near with my runner file, but still no results.

Upvotes: 3

Views: 123

Answers (1)

mlosev
mlosev

Reputation: 5227

I copied the code to run TestCafe in the 'run.js` file and then modified the test code as follows:

fixture `Fixture`;

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

After that, I ran the node run.js command in my terminal. I got the following test execution report.

test execution report You can see that the test word presents 3 times in the test execution report. So, the test will be run 3 times and TestCafe's quarantine mode works as expected.

Upvotes: 5

Related Questions