| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d32a914 commit 52f8dcf
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -829,11 +829,20 @@ class Test extends AsyncResource { | |||
| 829 | 829 | this.parent.activeSubtests--; | |
| 830 | 830 | } | |
| 831 | 831 | ||
| 832 | + // The call to processPendingSubtests() below can change the number of | ||
| 833 | + // pending subtests. When detecting if we are done running tests, we want | ||
| 834 | + // to check if there are no pending subtests both before and after | ||
| 835 | + // calling processPendingSubtests(). Otherwise, it is possible to call | ||
| 836 | + // root.run() multiple times (which is harmless but can trigger an | ||
| 837 | + // EventEmitter leak warning). | ||
| 838 | + const pendingSiblingCount = this.parent.pendingSubtests.length; | ||
| 839 | + | ||
| 832 | 840 | this.parent.addReadySubtest(this); | |
| 833 | 841 | this.parent.processReadySubtestRange(false); | |
| 834 | 842 | this.parent.processPendingSubtests(); | |
| 835 | 843 | ||
| 836 | 844 | if (this.parent === this.root && | |
| 845 | + pendingSiblingCount === 0 && | ||
| 837 | 846 | this.root.activeSubtests === 0 && | |
| 838 | 847 | this.root.pendingSubtests.length === 0 && | |
| 839 | 848 | this.root.readySubtests.size === 0) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + // Flags: --test-only | ||
| 2 | + 'use strict'; | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const { test } = require('node:test'); | ||
| 5 | + const { defaultMaxListeners } = require('node:events'); | ||
| 6 | + | ||
| 7 | + process.on('warning', common.mustNotCall()); | ||
| 8 | + | ||
| 9 | + for (let i = 0; i < defaultMaxListeners + 1; ++i) { | ||
| 10 | + test(`test ${i + 1}`); | ||
| 11 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments