Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Apr 30, 2020
1 parent 5cfb8d6 commit bb10ce9
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit bb10ce9

Please sign in to comment.