Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Functions

arange

  • arange(count: number): number[]
  • Range as array

    Parameters

    • count: number

    Returns number[]

ignoreError

  • ignoreError(err: Error): boolean
  • Ignore these errors

    Parameters

    • err: Error

    Returns boolean

makeRandomEmail

  • makeRandomEmail(config: {}, prefix: null | string): string
  • Generate a random email address.

    Parameters

    • config: {}

      The pentf configuration object. config.email needs to be set.

    • prefix: null | string

      Text to put before the random characters. If no prefix is specified, the test name is used if available.

    Returns string

    If config.email is 'foo@bar.com', something like foo+prefix129ad12@bar.com

randomHexstring

  • randomHexstring(len: number): string
  • Generate a random hex string.

    Parameters

    • len: number

      Length of the hex string.

    Returns string

    string A random hex string, e.g. A812F0D91

removeAt

  • removeAt(input: string, idx: number, count: number): string
  • Delete n characters at a specific position in a string

    Parameters

    • input: string
    • idx: number
    • count: number

    Returns string

wait

  • wait(ms: number): Promise<void>
  • Returns a promise that resolves after the specified time. This should be used sparingly and mostly for debugging tests.

    example
    await wait(10000); // wait for 10s
    

    Parameters

    • ms: number

      Number of milliseconds to wait.

    Returns Promise<void>

Generated using TypeDoc