From 0276ed81e0972bf2d42d64d695b7b393fb743142 Mon Sep 17 00:00:00 2001 From: Sarath P S Date: Wed, 11 Nov 2020 00:04:50 +0530 Subject: [PATCH] docs(*): added change log --- CHANGELOG.md | 6 ++++++ packages/jest-circus/src/eventHandler.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cbfb7b613fa..93ce3fc1b81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## master +### Chore & Maintenance + +- `[jest-circus]` Fixed issues of beforeAll & afterAll hooks getting executed even if it is inside a skipped `describe` block [#10451](https://github.com/facebook/jest/issues/10451) +- `[jest-jasmine2]` Fixed issues of beforeAll & afterAll hooks getting executed even if it is inside a skipped `describe` block when it has child `tests` marked as either `only` or `todo` [#10451](https://github.com/facebook/jest/issues/10451) +- `[jest-jasmine2]` Fixed issues of child `tests` marked with `only` or `todo` getting executed even when it is inside a parent `describe` block with skipped status [#10451](https://github.com/facebook/jest/issues/10451) + ### Features - `[jest-config]` [**BREAKING**] Default to Node testing environment instead of browser (JSDOM) ([#9874](https://github.com/facebook/jest/pull/9874)) diff --git a/packages/jest-circus/src/eventHandler.ts b/packages/jest-circus/src/eventHandler.ts index 31a0362ce321..af46770bcc62 100644 --- a/packages/jest-circus/src/eventHandler.ts +++ b/packages/jest-circus/src/eventHandler.ts @@ -79,6 +79,7 @@ const eventHandler: Circus.EventHandler = ( } if ( !state.hasFocusedTests && + currentDescribeBlock.mode !== 'skip' && currentDescribeBlock.children.some( child => child.type === 'test' && child.mode === 'only', ) @@ -143,7 +144,7 @@ const eventHandler: Circus.EventHandler = ( timeout, asyncError, ); - if (test.mode === 'only') { + if (currentDescribeBlock.mode !== 'skip' && test.mode === 'only') { state.hasFocusedTests = true; } currentDescribeBlock.children.push(test);