Page Contents

Home > @loopback/testlab > skipIf

skipIf() function

Helper function for skipping tests when a certain condition is met.

Signature:

export declare function skipIf<ARGS extends unknown[], RETVAL>(skip: boolean, verb: TestDefinition<ARGS, RETVAL> & {
    skip: TestDefinition<ARGS, RETVAL>;
}, name: string, ...args: ARGS): RETVAL;

Parameters

Parameter Type Description
skip boolean Should the test case/suite be skipped?
verb [TestDefinition](/doc/en/lb4/apidocs.testlab.testdefinition.html)<ARGS, RETVAL> & { skip: [TestDefinition](/doc/en/lb4/apidocs.testlab.testdefinition.html)<ARGS, RETVAL>; } The function to invoke to define the test case or the test suite, e.g. `it` or `describe`.
name string The test name (the first argument of `verb` function).
args ARGS Additional arguments (framework specific), typically a function implementing the test.

Returns:

RETVAL

Example

skipIf(
  !features.freeFormProperties,
  describe,
 'free-form properties (strict: false)',
  () => {
    // the tests
  }
);