From bfe684c9d57211bc5f1dd0d0ae9c9327e8dc5761 Mon Sep 17 00:00:00 2001 From: juergba Date: Wed, 29 Apr 2020 17:23:19 +0200 Subject: [PATCH] docs --- docs/index.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index ef4e4f9764..e1861189ac 100644 --- a/docs/index.md +++ b/docs/index.md @@ -449,7 +449,7 @@ setTimeout(function() { ### Failing Hooks -Upon a failing `before` hook all tests in the current suite and also its nested suites will be skipped. Skipped tests are included in the test results and marked as **skipped**. A skipped test is not considered a failed test. +Upon a failing "before all", "before each" or "after each" hook, all remaining tests in the current suite and also its nested suites will be skipped. Skipped tests are included in the test results and marked as **skipped**. A skipped test is not considered a failed test. ```js describe('outer', function() { @@ -481,6 +481,34 @@ describe('outer', function() { }); ``` +```js +describe('failing "before each" hook', function() { + beforeEach(function() { + // runs and fails only once + throw new Error('Exception in beforeEach hook'); + }); + + it('should skip this outer test', function() { + // will be skipped and reported as 'skipped' test + }); + + afterEach(function() {}); // will be executed + after(function() {}); // will be executed + + describe('inner suite', function() { + before(function() {}); // will be skipped + beforeEach(function() {}); // will be skipped + + it('should skip this inner test', function() { + // will be skipped and reported as 'skipped' test + }); + + afterEach(function() {}); // will be skipped + after(function() {}); // will be skipped + }); +}); +``` + ## Pending Tests "Pending" - as in "someone should write these test cases eventually" - test-cases are simply those _without_ a callback: