@wpazderski/playwright-utils
    Preparing search index...
    toThrowMatcher: (
        internalOptions: MatcherInternalOptions,
        received: unknown,
        expected?: unknown,
    ) => void = ...

    Calls the function and ensures it throws an error.

    Optionally compares the error with expected. Allowed expected values:

    • Regular expression - error message should match the pattern.
    • String - error message should include the substring.
    • Error object - error message should be equal to the message property of the object.
    • Error class - error object should be an instance of the class.

    Usage

    expect(() => {
    throw new Error('Something bad');
    }).toThrow();

    expect(() => {
    throw new Error('Something bad');
    }).toThrow(/something/);

    expect(() => {
    throw new Error('Something bad');
    }).toThrow(Error);

    Type declaration

      • (
            internalOptions: MatcherInternalOptions,
            received: unknown,
            expected?: unknown,
        ): void
      • Parameters

        • internalOptions: MatcherInternalOptions

          Internal options that provide extra context for the matcher.

        • received: unknown

          Received value.

        • Optionalexpected: unknown

          Expected error message or error object.

        Returns void