forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure root level hooks are called when running in watch mode
## Rationale Tests with root level hooks are ignored when running in watch mode. This occurs on initial & subsequent runs. ## Changes - extended `suite.clone` to clone hooks This change was necessary to ensure that when a suite is cloned during the setup phase for watch that hooks are available on the newly cloned suite. Note the use of `suite.clone` appears to be only used in `lib/cli/run-watch`. I did consider making the cloning of hooks optional but opted not to as `suite.clone` is internal to `mocha` & not publicly referenced in the API documentation. Tests for `suite.clone` have been amended to reflect the above change. - Extended integration tests for watch to take into consideration hooks ## Refs - mochajs/issues/4347
- Loading branch information
1 parent
02bdb6b
commit 4ef171d
Showing
4 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
mochaHooks: { | ||
["<hook>"]: function() { | ||
throw new Error("<hook> Hook Error"); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters