@salesforce/core
    Preparing search index...

    Function shouldThrowSync

    • Use for this testing pattern:

       try {
      call()
      assert.fail("this should never happen");
      } catch (e) {
      ...
      }

      Just do this

      try {
      shouldThrowSync(call); // If this succeeds unexpectedResultError is thrown.
      } catch(e) {
      ...
      }

      Parameters

      • f: () => unknown

        The function that is expected to throw.

      • Optionalmessage: string

      Returns never