Function tsExtractJestTests

  • Extracts Jest test cases from a given TypeScript code string.

    Parameters

    • code: string

      The TypeScript code string to extract Jest tests from.

    Returns string

    The extracted Jest tests as a string.

    Remarks

    This function is useful when you want to isolate and analyze test cases from a larger codebase. It works by finding the first line that starts with 'describe(' and the last line that is '})', and returns the lines in between. If it cannot find these lines, it throws an error.

    Throws

    Will throw an error if the input source code does not contain Jest tests.

Generated using TypeDoc