TestContext
An instance of TestContext
is passed to each test function in order to interact with the test runner. However, the TestContext
constructor is not exposed as part of the API.
Since
v18.0.0, v16.17.0
Properties
Functions
This function is used to create a hook that runs after the current test finishes.
This function is used to create a hook running after each subtest of the current test.
This function is used to create a hook running before subtest of the current test.
This function is used to create a hook running before each subtest of the current test.
This function is used to write diagnostics to the output. Any diagnostic information is included at the end of the test's results. This function does not return a value.
This function is used to set the number of assertions and subtests that are expected to run within the test. If the number of assertions and subtests that run does not match the expected count, the test will fail.
This method polls a condition
function until that function either returns successfully or the operation times out.