https://github.com/nitive/nightwatch-mocha-each-hooks
https://github.com/nitive/nightwatch-mocha-each-hooks
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nitive/nightwatch-mocha-each-hooks
- Owner: Nitive
- Created: 2019-06-18T18:01:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-05T13:13:40.000Z (over 3 years ago)
- Last Synced: 2025-07-22T11:03:10.022Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 229 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# beforeEach and afterEach hooks bug example
Problem: beforeEach and afterEach hooks are not called when using mocha runner.
Issue: https://github.com/nightwatchjs/nightwatch/issues/1477
Steps to reproduce:
1. Install dependencies with `npm install` or `yarn install`
2. Run `npm run nightwatch`. The output will be:
```bash
> nightwatch
GLOBAL before
GLOBAL beforeEach
Running: Demo test GitHub
✔ Element was visible after 25 milliseconds.
✔ Element <.container h1 strong a> was visible after 23 milliseconds.
✔ Checking project title is set to nightwatch - 25 ms.
OK. 3 assertions passed. (2.581s)
GLOBAL afterEach
GLOBAL after
```
You can see that beforeEach and afterEach hooks have been called
3. Run `npm run mocha`. The output will be:
```bash
> MOCHA=1 nightwatch
GLOBAL before
Github
✓ Demo test GitHub (1468ms)
1 passing (3s)
GLOBAL after
```
beforeEach and afterEach hooks have not been called