Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

AssertionErrorAdditions

AssertionErrorAdditions: AssertionError & object

AssertionFn

AssertionFn: function

Type declaration

    • (res: Result): AssertionError | void
    • Parameters

      Returns AssertionError | void

BatchFunction

BatchFunction: function

The type of a function that runs in Batch

Type declaration

BatchFunctionArg

BatchFunctionArg: NextFn | Result | Error | NodeError | JokerError

MainFn

MainFn: function | function

NextFn

NextFn: function

Type declaration

    • (): void
    • Returns void

NodeError

NodeError: function

Type declaration

    • (err: ErrnoException): void
    • Parameters

      • err: ErrnoException

      Returns void

Register

Register: Record<string, Function>

Primitive plugin support.

It will add the supplied `fn to Runner's prototype.

Examples:

Register a single function, could be both middleware or expectation:

joker.register('stdoutNotEqual', fn);

Later on this can be used as you would expect:

 new Joker()
   .run('ls /tmp')
   .stdoutNotEqual('xxx')
   .end()

In case you want to register more than one function at once you may want to pass an object:

 joker.register({
   name: fn,
   otherName: fn2,
   etc: etc,
 });

The second example might come handy when developing plugins. Keep in mind that the plugin system will most certainly change in future version (prior hitting 1.0.0). The current implementation has some obvious problems like what plugin developers will do if they happen to use the same function name. Any ideas and suggestions are more than welcome.

param
param

ReturnFn

ReturnFn: function

Type declaration

Functions

Plugin

  • Plugin(name: string | Register, fn?: Function): Function
  • Register functions and add them to the prototype of Runner

    Parameters

    • name: string | Register
    • Default value fn: Function = () => {}

    Returns Function

Private assertOut

Private code

Private done

  • done(next: NextFn): function
  • Callback generator for middlewares. Throw errors if any.

    Parameters

    Returns function

      • (err: AssertionError): void
      • Parameters

        • err: AssertionError

        Returns void

Private error

  • Create and return a new AssertionError. It will assign the given result to it, it will also prepend the executed command to the error message.

    Assertion error is a constructor for test and validation frameworks that implements standardized Assertion Error specification.

    For more info go visit https://github.com/chaijs/assertion-error

    Parameters

    • result: Result
    • message: string
    • options: Options
    • Optional expected: string | number | RegExp
    • Optional actual: string | number

    Returns AssertionErrorAdditions

Private exec

Private exists

Private match

Private mkdir

Private rmdir

Private run

  • run(readable: stream.Readable, writable: stream.Writable, expects: (string | RegExp)[], responses: string[]): void
  • Read interactive prompts on a stream and write the associated response to another

    Largely borrowed from @jprichardson's module "node-suppose" https://github.com/jprichardson/node-suppose/

    Parameters

    • readable: stream.Readable
    • writable: stream.Writable
    • expects: (string | RegExp)[]
    • responses: string[]

    Returns void

Private stderr

Private stdout

Private time

Private unlink

Private writeFile

  • writeFile(path: string, data: string): ReturnFn
  • Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer.

    see

    [[fs.writeFile]]

    Parameters

    • path: string
    • data: string

    Returns ReturnFn

    middleware

Object literals

Const DEFAULT_OPTIONS

DEFAULT_OPTIONS: object

The default options for Runner. See Options for more details

colors

colors: true = true

newLines

newLines: true = true

showDiffs

showDiffs: true = true

showStdErr

showStdErr: true = true

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc