OptionalextensionExtension of dynamic functions.
OptionalfilterFilter 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.
Native boundary: The predicate receives the entry name exactly as
readdir lists it, without case or separator normalization, so a
comparison on a case-insensitive volume is the caller's to make.
File name (basename) of the dynamic functions
Whether to run or not
contracts/common.md#principled-implementation The predicate is evaluated on the file basename before the file is imported, so a false result prevents both the import and the execution of every function in it.
Location of the test functions.
OptionalonOn complete function.
Listener of completion of a test function.
A thrown listener error rejects the run in either mode after active module tasks settle; listeners should handle their reporting errors.
Execution result of a test function
contracts/common.md#principled-implementation The listener is called from the finally of each execution with the execution record, so it observes both success and failure, after the completion time is set.
Get parameters of a function.
Function name
Parameters
contracts/common.md#principled-implementation The function is called with the function name at each execution and returns the argument list, so each test gets fresh parameters keyed by its name.
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.
OptionalsimultaneousNumber 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.
OptionalwrapperWrapper 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.
Function name
Function to be executed
Parameters, result of options.parameters function.
Wrapper function
contracts/common.md#principled-implementation When present, the wrapper is called instead of the function directly with the name, the function, and the parameters, so a caller can add setup, retries, or measurement around each test.
contracts/common.md#clear-and-simple-design One optional callback that replaces the direct call.
Options for dynamic executor.
Native boundary: The location is a native directory path resolved with
path.resolve, the extension is a suffix without a dot, andsimultaneousbounds in-process runs only, so no process or thread is created.Evidence
contracts/common.md#principled-implementation The fields are what selection and execution need: the prefix, the location, the parameter factory, and optional hooks, concurrency, and extension;
simultaneousand the extension have documented defaults.Evidence
contracts/common.md#clear-and-simple-design A flat option record whose optional members are the extension points (listener, filter, wrapper).
Evidence
contracts/common.md#prohibited-implementation-shortcuts Every value is caller-supplied; the defaults are the documented ones (
js, one at a time).Evidence
contracts/common.md#meaningful-documentation Each option documents its meaning, including that the filter receives a file basename and never a function name.