From bb10ce9d28472b6c9de82113afcf82edc2f28b56 Mon Sep 17 00:00:00 2001 From: juergba Date: Wed, 29 Apr 2020 17:23:19 +0200 Subject: [PATCH] docs --- docs/index.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index ef4e4f9764..271cbd07fe 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,36 @@ describe('outer', function() { }); ``` +#### "before each" hook + +```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() { + // all hooks, tests and nested suites will be skipped + + it('should skip this inner test', function() { + // will be skipped and reported as 'skipped' test + }); + }); +}); +``` + ## Pending Tests "Pending" - as in "someone should write these test cases eventually" - test-cases are simply those _without_ a callback: