@@ -510,6 +510,9 @@ This module can export any of the following:
510510* A ` globalSetup ` function which runs once before all tests start
511511* A ` globalTeardown ` function which runs once after all tests complete
512512
513+ If ` globalSetup ` returns a value, that value is passed as the first argument to
514+ ` globalTeardown ` .
515+
513516The module is specified using the ` --test-global-setup ` flag when running tests from the command line.
514517
515518``` cjs
@@ -520,9 +523,10 @@ async function globalSetup() {
520523 // Run servers, create files, prepare databases, etc.
521524}
522525
523- async function globalTeardown () {
526+ async function globalTeardown (context ) {
524527 // Clean up resources, state, or environment
525528 console .log (' Global teardown executed' );
529+ console .log (context);
526530 // Close servers, remove files, disconnect from databases, etc.
527531}
528532
@@ -537,9 +541,10 @@ export async function globalSetup() {
537541 // Run servers, create files, prepare databases, etc.
538542}
539543
540- export async function globalTeardown () {
544+ export async function globalTeardown (context ) {
541545 // Clean up resources, state, or environment
542546 console .log (' Global teardown executed' );
547+ console .log (context);
543548 // Close servers, remove files, disconnect from databases, etc.
544549}
545550```
0 commit comments