| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 916e876 commit afa8291
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -731,13 +731,24 @@ class Suite extends Test { | |||
| 731 | 731 | } | |
| 732 | 732 | ||
| 733 | 733 | const hookArgs = this.getRunArgs(); | |
| 734 | + | ||
| 735 | + if (this.parent?.hooks.beforeEach.length > 0) { | ||
| 736 | + await this.parent[kRunHook]('beforeEach', hookArgs); | ||
| 737 | + } | ||
| 738 | + | ||
| 734 | 739 | await this[kRunHook]('before', hookArgs); | |
| 740 | + | ||
| 735 | 741 | const stopPromise = stopTest(this.timeout, this.signal); | |
| 736 | 742 | const subtests = this.skipped || this.error ? [] : this.subtests; | |
| 737 | 743 | const promise = SafePromiseAll(subtests, (subtests) => subtests.start()); | |
| 738 | 744 | ||
| 739 | 745 | await SafePromiseRace([promise, stopPromise]); | |
| 740 | 746 | await this[kRunHook]('after', hookArgs); | |
| 747 | + | ||
| 748 | + if (this.parent?.hooks.afterEach.length > 0) { | ||
| 749 | + await this.parent[kRunHook]('afterEach', hookArgs); | ||
| 750 | + } | ||
| 751 | + | ||
| 741 | 752 | this.pass(); | |
| 742 | 753 | } catch (err) { | |
| 743 | 754 | if (isTestFailureError(err)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,10 +15,12 @@ describe('describe hooks', () => { | |||
| 15 | 15 | 'before describe hooks', | |
| 16 | 16 | 'beforeEach 1', '1', 'afterEach 1', | |
| 17 | 17 | 'beforeEach 2', '2', 'afterEach 2', | |
| 18 | + 'beforeEach nested', | ||
| 18 | 19 | 'before nested', | |
| 19 | 20 | 'beforeEach nested 1', 'nested 1', 'afterEach nested 1', | |
| 20 | 21 | 'beforeEach nested 2', 'nested 2', 'afterEach nested 2', | |
| 21 | 22 | 'after nested', | |
| 23 | + 'afterEach nested', | ||
| 22 | 24 | 'after describe hooks', | |
| 23 | 25 | ]); | |
| 24 | 26 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,8 +34,8 @@ test('top level test enabled', common.mustCall(async (t) => { | |||
| 34 | 34 | ||
| 35 | 35 | describe('top level describe enabled', () => { | |
| 36 | 36 | before(common.mustCall()); | |
| 37 | - beforeEach(common.mustCall(2)); | ||
| 38 | - afterEach(common.mustCall(2)); | ||
| 37 | + beforeEach(common.mustCall(4)); | ||
| 38 | + afterEach(common.mustCall(4)); | ||
| 39 | 39 | after(common.mustCall()); | |
| 40 | 40 | ||
| 41 | 41 | it('nested it disabled', common.mustNotCall()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments