| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 82a53bf commit c0c3dde
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - // https://github.com/nodejs/node/blob/87170c3f9271da947a7b33d0696ec4cf8aab6eb6/lib/internal/test_runner/test.js | ||
| 1 | + // https://github.com/nodejs/node/blob/a69a30016cf3395b0bd775c1340ab6ecbac58296/lib/internal/test_runner/test.js | ||
| 2 | 2 | ||
| 3 | 3 | 'use strict' | |
| 4 | 4 | ||
@@ -738,13 +738,24 @@ class Suite extends Test { | |||
| 738 | 738 | } | |
| 739 | 739 | ||
| 740 | 740 | const hookArgs = this.getRunArgs() | |
| 741 | + | ||
| 742 | + if (this.parent?.hooks.beforeEach.length > 0) { | ||
| 743 | + await this.parent[kRunHook]('beforeEach', hookArgs) | ||
| 744 | + } | ||
| 745 | + | ||
| 741 | 746 | await this[kRunHook]('before', hookArgs) | |
| 747 | + | ||
| 742 | 748 | const stopPromise = stopTest(this.timeout, this.signal) | |
| 743 | 749 | const subtests = this.skipped || this.error ? [] : this.subtests | |
| 744 | 750 | const promise = SafePromiseAll(subtests, (subtests) => subtests.start()) | |
| 745 | 751 | ||
| 746 | 752 | await SafePromiseRace([promise, stopPromise]) | |
| 747 | 753 | await this[kRunHook]('after', hookArgs) | |
| 754 | + | ||
| 755 | + if (this.parent?.hooks.afterEach.length > 0) { | ||
| 756 | + await this.parent[kRunHook]('afterEach', hookArgs) | ||
| 757 | + } | ||
| 758 | + | ||
| 748 | 759 | this.pass() | |
| 749 | 760 | } catch (err) { | |
| 750 | 761 | if (isTestFailureError(err)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - // https://github.com/nodejs/node/blob/659dc126932f986fc33c7f1c878cb2b57a1e2fac/test/message/test_runner_hooks.js | ||
| 1 | + // https://github.com/nodejs/node/blob/a69a30016cf3395b0bd775c1340ab6ecbac58296/test/message/test_runner_hooks.js | ||
| 2 | 2 | // Flags: --no-warnings | |
| 3 | 3 | 'use strict' | |
| 4 | 4 | require('../common') | |
@@ -16,10 +16,12 @@ describe('describe hooks', () => { | |||
| 16 | 16 | 'before describe hooks', | |
| 17 | 17 | 'beforeEach 1', '1', 'afterEach 1', | |
| 18 | 18 | 'beforeEach 2', '2', 'afterEach 2', | |
| 19 | + 'beforeEach nested', | ||
| 19 | 20 | 'before nested', | |
| 20 | 21 | 'beforeEach nested 1', 'nested 1', 'afterEach nested 1', | |
| 21 | 22 | 'beforeEach nested 2', 'nested 2', 'afterEach nested 2', | |
| 22 | 23 | 'after nested', | |
| 24 | + 'afterEach nested', | ||
| 23 | 25 | 'after describe hooks' | |
| 24 | 26 | ]) | |
| 25 | 27 | }) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - // https://github.com/nodejs/node/blob/87170c3f9271da947a7b33d0696ec4cf8aab6eb6/test/message/test_runner_test_name_pattern.js | ||
| 1 | + // https://github.com/nodejs/node/blob/a69a30016cf3395b0bd775c1340ab6ecbac58296/test/message/test_runner_test_name_pattern.js | ||
| 2 | 2 | // Flags: --no-warnings --test-name-pattern=enabled --test-name-pattern=/pattern/i | |
| 3 | 3 | 'use strict' | |
| 4 | 4 | const common = require('../common') | |
@@ -35,8 +35,8 @@ test('top level test enabled', common.mustCall(async (t) => { | |||
| 35 | 35 | ||
| 36 | 36 | describe('top level describe enabled', () => { | |
| 37 | 37 | before(common.mustCall()) | |
| 38 | - beforeEach(common.mustCall(2)) | ||
| 39 | - afterEach(common.mustCall(2)) | ||
| 38 | + beforeEach(common.mustCall(4)) | ||
| 39 | + afterEach(common.mustCall(4)) | ||
| 40 | 40 | after(common.mustCall()) | |
| 41 | 41 | ||
| 42 | 42 | it('nested it disabled', common.mustNotCall()) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments