夹具或测试的隔离模式

Quarantine mode for the fixture or test

是否可以在隔离模式下 运行 一些测试,而在没有模式的情况下 运行 其他测试? 例如,我们有一些轻量级测试,我们不需要对它们进行 3 次尝试,但对于其他人来说,这可能是必要的

您可以 运行 两个测试咖啡馆 运行 不同 filters 的人串联。其中之一可能是隔离模式。

例如:

const createTestCafe = require('testcafe');

let testcafe = null;

const runTests = (testFiles, quarantineMode, testPrefix) => {
    const runner = testcafe.createRunner();
    return runner
        .src(testFiles)
        .filter((testName) => testName.startsWith(testPrefix))
        .browsers(['chrome'])
        .run({ quarantineMode });
};

createTestCafe('localhost', 1337, 1338)
    .then(tc => {
        testcafe = tc;
        return runTests(['test.js'], false, 'Simple')
            .then(() => runTests(['test.js'], true, 'Complex'));
    })
    .then(() => testcafe.close());

测试:

test('Simple Test', async t => {
    //...
});

test('Complex Test', async t => {
    //...
});