Ende.TestDefinition
interface
interface Ende.TestDefinitionProperties
fn
fn: (t: TestContext) => void | Promise<void>name
name: stringThe name of the test.
ignore
ignore?: booleanIf truthy the current test step will be ignored.
It is a quick way to skip over a step, but also can be used for conditional logic, like determining if an environment feature is present.
only
only?: booleanIf at least one test has only set to true, only run tests that have
only set to true and fail the test suite.
sanitizeOps
sanitizeOps?: booleanCheck that the number of async completed operations after the test step is the same as number of dispatched operations. This ensures that the code tested does not start async operations which it then does not await. This helps in preventing logic errors and memory leaks in the application code.
Can also be enabled globally with the --sanitize-ops CLI flag,
the ENDE_TEST_SANITIZE_OPS=1 environment variable, or the
test.sanitizeOps option in ende.json. Can be set per-module
with Ende.test.sanitizer.
Default: false
sanitizeResources
sanitizeResources?: booleanEnsure the test step does not "leak" resources - like open files or network connections - by ensuring the open resources at the start of the test match the open resources at the end of the test.
Can also be enabled globally with the --sanitize-resources CLI flag,
the ENDE_TEST_SANITIZE_RESOURCES=1 environment variable, or the
test.sanitizeResources option in ende.json. Can be set per-module
with Ende.test.sanitizer.
Default: false
sanitizeExit
sanitizeExit?: booleanEnsure the test case does not prematurely cause the process to exit,
for example via a call to Ende.exit.
Default: true
permissions
permissions?: PermissionOptionsSpecifies the permissions that should be used to run the test.
Set this to "inherit" to keep the calling runtime permissions, set this
to "none" to revoke all permissions, or set a more specific set of
permissions using a PermissionOptionsObject.
Default: "inherit"
timeout
timeout?: numberMaximum duration in milliseconds that the test is allowed to run before being marked as a failed test. Both asynchronous hangs and synchronous hot loops are caught.
If unset or 0, the test runs without a deadline.
retry
retry?: numberNumber of times to re-run the test if it fails. The test is considered to have passed if any attempt passes. Useful for tolerating flaky tests.
When set, this takes precedence over the --retry flag, including an
explicit 0 which opts the test out of a flag-provided default.
Default: 0
repeats
repeats?: numberNumber of additional times to run the test. Every repetition must pass
for the test to pass. Useful for surfacing flaky tests. When combined
with TestDefinition.retry, each repetition may itself be
retried.
When set, this takes precedence over the --repeats flag, including an
explicit 0 which opts the test out of a flag-provided default.
Default: 0