Skip to content

Add new config hook: QUnit.config.testIf(() => {}) #1814

@NullVoxPopuli

Description

@NullVoxPopuli

I see that there exists QUnit.test.if(name, condition, testCallback), but using this does not integrate well with flaky-test quarantine strategies.

For example, when running tests, we generate an ourput file (JUnit XML, or whatever), and then the quarantine system interprets that and does some analysis to determine if a test is flaky (over the course of multiple runs).

Next time we start a test suite, we have the list of known flaky tests ahead of time (as a json object available to us on page load).

I'd like to have something like:

const myQuarantineList = []; // actually from file / api / whatever


QUnit.config.testIf((info) => {
  let { id, name } = info;

  let isQuarantined = myQuarantineList.find(x => {
    if (name === x) return true;

    return new RegExp(x).test(name);
  });

  return !isQuarantined;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions