Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 587
Maksim Avatar asked Feb 11 '26 21:02

Maksim


1 Answers

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.

like image 172
mlosev Avatar answered Feb 15 '26 10:02

mlosev