@salesforce/core
    Preparing search index...

    Function shouldThrow

    • Use for this testing pattern:

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

      Just do this

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

      Parameters

      • f: Promise<unknown>

        The async function that is expected to throw.

      • Optionalmessage: string

      Returns Promise<never>