BUPKIS
    Preparing search index...
    • Builds a fast-check tuple filter that rejects assertion-argument tuples for which the assertion actually passes.

      "Invalid" generators commonly build [subject, phrase, ...params] tuples by generating the subject and params independently, assuming the result won't satisfy the assertion. That assumption breaks for subset-style assertions such as to satisfy/to be like: a superset subject legitimately passes, and fast-check's shrinker actively drives generated values toward that overlap (e.g. collapsing both sides to { '': null }). Filtering with this guard keeps an "invalid" generator's outputs genuinely invalid.

      The returned predicate invokes expectFn once per generated (and shrunk) tuple, so pass the same bound expect the assertion is tested with. Because fc.Arbitrary.filter is synchronous, this guard only supports synchronous assertions.

      Parameters

      • expectFn: (value: unknown, ...args: [phrase: string, ...unknown[]]) => void

        The synchronous expect function used to evaluate each tuple

      Returns (args: readonly [unknown, string, unknown]) => boolean

      A predicate suitable for fc.Arbitrary.filter over argument tuples of the form [subject, phrase, ...params]

      import { expect } from 'bupkis';

      const invalidArgs = fc
      .oneof(objectsThatUsuallyDoNotSatisfy, arraysThatUsuallyDoNotSatisfy)
      .filter(rejectPassing(expect));