Documentation
    Preparing search index...

    Interface IProps<Parameters, Ret>

    Options for dynamic executor.

    interface IProps<Parameters extends any[], Ret = any> {
        extension?: string;
        filter?: (file: string) => boolean;
        location: string;
        onComplete?: (exec: IExecution) => void;
        parameters: (name: string) => Parameters;
        prefix: string;
        simultaneous?: number;
        wrapper?: (
            name: string,
            closure: DynamicExecutor.Closure<Parameters, Ret>,
            parameters: Parameters,
        ) => Promise<any>;
    }

    Type Parameters

    • Parameters extends any[]
    • Ret = any
    Index

    Properties

    extension?: string

    Extension of dynamic functions.

    js
    
    filter?: (file: string) => boolean

    Filter function whether to run or not.

    The filter function is called with the file name (basename) of each dynamic function module, not with the function name. When it returns false, the file would never be imported, so that every function defined in the file would never be executed either.

    Type Declaration

      • (file: string): boolean
      • Parameters

        • file: string

          File name (basename) of the dynamic functions

        Returns boolean

        Whether to run or not

    location: string

    Location of the test functions.

    onComplete?: (exec: IExecution) => void

    On complete function.

    Listener of completion of a test function.

    Type Declaration

    parameters: (name: string) => Parameters

    Get parameters of a function.

    Type Declaration

    prefix: string

    Prefix of function name.

    Every prefixed function will be executed.

    In other words, if a function name doesn't start with the prefix, then it would never be executed. Also, when a file name (basename) does not start with the prefix, the file would never be imported either, so that every function defined in the file would never be executed.

    simultaneous?: number

    Number of simultaneous requests.

    The number of requests to be executed simultaneously.

    If you configure a value greater than one, the dynamic executor will process the functions concurrently with the given capacity value.

    1
    
    wrapper?: (
        name: string,
        closure: DynamicExecutor.Closure<Parameters, Ret>,
        parameters: Parameters,
    ) => Promise<any>

    Wrapper of test function.

    If you specify this wrapper property, every dynamic functions loaded and called by this DynamicExecutor would be wrapped by the wrapper function.

    Type Declaration