diff --git a/packages/jest-circus/src/eventHandler.ts b/packages/jest-circus/src/eventHandler.ts index 590e66ca3a13..dfe916a629a1 100644 --- a/packages/jest-circus/src/eventHandler.ts +++ b/packages/jest-circus/src/eventHandler.ts @@ -148,6 +148,7 @@ const eventHandler: Circus.EventHandler = ( state.hasFocusedTests = true; } currentDescribeBlock.children.push(test); + currentDescribeBlock.tests.push(test); break; } case 'hook_failure': { diff --git a/packages/jest-circus/src/utils.ts b/packages/jest-circus/src/utils.ts index 2a5322607d17..ca9bebeef466 100644 --- a/packages/jest-circus/src/utils.ts +++ b/packages/jest-circus/src/utils.ts @@ -34,6 +34,7 @@ export const makeDescribe = ( mode: _mode, name: convertDescriptorToString(name), parent, + tests: [], }; }; diff --git a/packages/jest-types/src/Circus.ts b/packages/jest-types/src/Circus.ts index 963a6a61b537..c1ef85c79892 100644 --- a/packages/jest-types/src/Circus.ts +++ b/packages/jest-types/src/Circus.ts @@ -207,6 +207,8 @@ export type DescribeBlock = { mode: BlockMode; name: BlockName; parent?: DescribeBlock; + /** @deprecated Please get from `children` array instead */ + tests: Array; }; export type TestError = Exception | [Exception | undefined, Exception]; // the error from the test, as well as a backup error for async