@@ -105,9 +105,12 @@ If any tests fail, the process exit code is set to `1`.
105105
106106## Subtests
107107
108- The test context's ` test() ` method allows subtests to be created. This method
109- behaves identically to the top level ` test() ` function. The following example
110- demonstrates the creation of a top level test with two subtests.
108+ The test context's ` test() ` method allows subtests to be created.
109+ It allows you to structure your tests in a hierarchical manner,
110+ where you can create nested tests within a larger test.
111+ This method behaves identically to the top level ` test() ` function.
112+ The following example demonstrates the creation of a
113+ top level test with two subtests.
111114
112115``` js
113116test (' top level test' , async (t ) => {
@@ -121,9 +124,13 @@ test('top level test', async (t) => {
121124});
122125```
123126
127+ > ** Note:** ` beforeEach ` and ` afterEach ` hooks are triggered
128+ > between each subtest execution.
129+
124130In this example, ` await ` is used to ensure that both subtests have completed.
125131This is necessary because parent tests do not wait for their subtests to
126- complete. Any subtests that are still outstanding when their parent finishes
132+ complete, unlike tests created with the ` describe ` and ` it ` syntax.
133+ Any subtests that are still outstanding when their parent finishes
127134are cancelled and treated as failures. Any subtest failures cause the parent
128135test to fail.
129136
0 commit comments