-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a "run cycle overview" to documentation #3455
Changes from 8 commits
6539408
0fed780
accd42c
1548191
82a368e
6b8e084
974b891
c981dc6
004999c
1d7cfe3
8be5768
931bfb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ Mocha is a feature-rich JavaScript test framework running on [Node.js](https://n | |
|
||
- [Installation](#installation) | ||
- [Getting Started](#getting-started) | ||
- [Run Cycle overview](#run-cycle-overview) | ||
- [Detects Multiple Calls to `done()`](#detects-multiple-calls-to-done) | ||
- [Assertions](#assertions) | ||
- [Asynchronous Code](#asynchronous-code) | ||
|
@@ -142,6 +143,47 @@ Then run tests with: | |
$ npm test | ||
``` | ||
|
||
## Run Cycle overview | ||
|
||
A brief outline on the order Mocha's components are invoked. | ||
Worth noting that all hooks, 'describe' and 'it' callbacks are run in the order they are defined (i.e. found in the file). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about wrap 'describe' and 'it' by ` not ' ? |
||
|
||
``` java | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the codefence language set to 'java'? Maybe use 'text' instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see. You were highlighting the Mocha functions in red. [//]: # (Used 'java' language so Mocha globals are highlighted) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A Markdown comment must be on its own line. Think it also requires surrounding blank lines (both before and after it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note now that the highlighting you had from before no longer occurs. Only dashed lines are shown in red (as though you had used 'text' for codefence language). Did quick test and defining the codefence language as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You didn't make any changes here. Surprised But does the lack of highlighting eliminate the need for the comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. codefence highlighting/markdown comment is what has been blocking it for 3 weeks... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had missed this comment, will address it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @plroebuck tried myself agree |
||
run 'mocha spec.js' | ||
| | ||
spawn child process | ||
| | ||
|--------------> inside child process | ||
process and apply options | ||
| | ||
run spec file/s | ||
| | ||
|--------------> per spec file | ||
'describe' callbacks | ||
plroebuck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | ||
'before' root-level pre-hook | ||
| | ||
'before' pre-hook | ||
| | ||
|--------------> per test | ||
'beforeEach' root-level pre-hook | ||
| | ||
'beforeEach' pre-hook | ||
| | ||
'it' callbacks | ||
plroebuck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | ||
'afterEach' post-hook | ||
| | ||
'afterEach' root-level post-hook | ||
|--------------> per test end | ||
plroebuck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | ||
'after' post-hook | ||
| | ||
'after' root-level post-hooks | ||
|--------------> per spec file end | ||
|--------------> inside child process end | ||
``` | ||
|
||
## Detects Multiple Calls to `done()` | ||
|
||
If you use callback-based async tests, Mocha will throw an error if `done()` is called multiple times. This is handy for catching accidental double callbacks. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overview
->Overview
?