Hierarchy

  • ClifryAPI

Properties

dir: string

The working directory of the test. Use this if you are loading or storing files as a part of your test.

Methods

  • Writes an error log message to Clifry's console output.

    Remarks

    You can monitor Clifry's test log to help debug problems during your test.

    Parameters

    • message: string

      The error message to print.

    Returns void

  • Sends SIGINT to your CLI.

    Returns void

  • Gets an array of the entire stderr so far.

    Returns

    An array of lines that have been outputted to stdout

    Returns string[]

  • Gets an array of the entire stdout so far.

    Returns

    An array of lines that have been outputted to stdout

    Returns string[]

  • Writes a message to Clifry's console log output.

    Remarks

    You can monitor Clifry's test log to help debug problems during your test.

    Parameters

    • message: string

      The message to print.

    Returns void

  • Pause the test and read a line from the console.

    Returns

    Whatever was typed in the console.

    Parameters

    • message: string

      The message to promt during the test.

    Returns Promise<unknown>

  • Do nothing for a period of time in case you need to wait for your CLI.

    Returns

    A promise that will resolve when the sleep is over.

    Parameters

    • ms: number

      The number of ms to sleep for.

    Returns Promise<unknown>

  • Starts your CLI process and begins the test.

    Returns

    A promise that will resolve true when your CLI starts, or will throw an error on timeout.

    Parameters

    • timeout: number = 0

      Optional: Max time to wait for your CLI to start (ms).

    Returns Promise<unknown>

  • Wait until your CLI's stdout and stderr have been quiet for N seconds.

    Returns

    A promise that will resolve true if the CLI becomes idle for the desired time, or will throw an error on timeout.

    Parameters

    • seconds: Number

      The desired number of seconds of idle time.

    • timeout: number = 0

      Optional: Max time to wait for your CLI to become idle (ms).

    Returns Promise<unknown>

  • Wait until a line of stderr matches your search string exactly.

    Returns

    a promise that will resolve true if a match is found, or will throw an error on timeout..

    Parameters

    • search: string

      The string you'd like stderr to match exactly. *

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a match (ms).

    Returns Promise<unknown>

  • Wait until a line of stderr includes the search string (using javascript string.includes)

    Remarks

    See untilStdoutIncludes for example usage.

    Returns

    a promise that will resolve true if a match is found, or will throw an error on timeout.

    Parameters

    • search: string

      The string you'd like the output to include. *

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a match (ms).

    Returns Promise<unknown>

  • Wait until a line of your CLI's stderr passes your supplied matching function.

    Remarks

    See untilStdoutPasses for example isage.

    Returns

    a promise that will resolve true if your test is passed, or will throw an error on timeout.

    Parameters

    • uniqueID: string

      This is required to enable calling your test multiple times throughout the course of a test.

    • logMessage: string

      This will be printed in CliFry's log and should be short but descriptive, so that you can see clearly when your function passed or failed.

    • test: ((line: string) => boolean)
        • (line: string): boolean
        • Parameters

          • line: string

          Returns boolean

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a match (ms).

    Returns Promise<unknown>

  • Wait until a line of stdout matches your search string exactly.

    Returns

    a promise that will resolve true if a match is found, or will throw an error on timeout.

    Parameters

    • search: string

      The string you'd like stdout to match exactly. *

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a match (ms).

    Returns Promise<unknown>

  • Wait until a line of stdout includes the search string (using javascript string.includes).

    Remarks

    Example: If you wanted to wait until your CLI outputted: "At 10:23am, the CLI completed job #124789124987, but you only cared about a portion of that line, using a search parameter of "the CLI completed job" would return true.

    Returns

    a promise that will resolve true if a match is found, or will throw an error on timeout.

    Parameters

    • search: string

      The string you'd like the output to include.

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a match (ms).

    Returns Promise<unknown>

  • Wait until a line of your CLI's stdout passes your supplied matching function.

    Remarks

    uniqueID is used as an index any time you re-search with the same function. For example if you search and find something, then later you want to find something again, using the same uniqueID will tell Clifry that you want to start where the previous search left off rather than starting again from the beginning of the entire output.

    Returns

    a promise that will resolve true if your test is passed, or will throw an error on timeout.

    Parameters

    • uniqueID: string

      This is required to enable calling your test multiple times throughout the course of a test.

    • logMessage: string

      This will be printed in CliFry's log and should be short but descriptive, so that you can see clearly when your function passed or failed.

    • test: ((line: string) => boolean)
        • (line: string): boolean
        • Parameters

          • line: string

          Returns boolean

    • backtrack: boolean = false

      Optional: Test includes output since last call to test.

    • timeout: number = 0

      Optional: Max time to wait for a pass (ms).

    Returns Promise<unknown>

  • Waits until your CLI stops on its own, or is already stopped.

    Returns

    A promise that will resolve with the CLI's exit code, or will throw an error on timeout.

    Parameters

    • timeout: number = 0

      Optional: Max time to wait for your CLI to stop on its own (ms).

    Returns Promise<unknown>

  • Writes a line to your CLI's stdin.

    Parameters

    • txt: string

      the text to write to stdin (no need for newline or carriage return).

    Returns void

Generated using TypeDoc