-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Hooks for test cases (RuleTester) (#18771)
* Add setup next to options. * The prop type assertion. * Execute if present. * Positive test. * Negative test. * docs: Listing the property. * Renaming `setup` to `before` according to RFC * Testing corner case one: before() throws. * Introducing the hook after(), draft impl. * Add `after` to API docs. * Ref: DNRY: running similar tests in Array::forEach(). * Ref: DNRY: extracting the hook runner into runHook() helper. * Moving call of the after() hook, using try..finally, testing last corner cases. * Moving call of before() into the try..finaly for code clarity and consistency. * Testing that hooks are called both for valid and invalid cases. * CR suggestion accepted: using strictEqual in runHook() Co-authored-by: Nicholas C. Zakas <[email protected]> * CR accepted in docs: rm article Co-authored-by: Josh Goldberg ✨ <[email protected]> * CR: typo fix in sample error message. Co-authored-by: Milos Djermanovic <[email protected]> * CR: Testing invalid cases in all tests. * CR: Additional test for syntax errors. --------- Co-authored-by: Nicholas C. Zakas <[email protected]> Co-authored-by: Josh Goldberg ✨ <[email protected]> Co-authored-by: Milos Djermanovic <[email protected]>
- Loading branch information
1 parent
493348a
commit 17a07fb
Showing
3 changed files
with
192 additions
and
2 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
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