| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2922290 commit 659d5bf
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3430,6 +3430,9 @@ added: | |||
| 3430 | 3430 | - v18.9.0 | |
| 3431 | 3431 | - v16.19.0 | |
| 3432 | 3432 | changes: | |
| 3433 | + - version: REPLACEME | ||
| 3434 | + pr-url: https://github.com/nodejs/node/pull/63435 | ||
| 3435 | + description: Added `parentId` to test events that carry a `testId`. | ||
| 3433 | 3436 | - version: | |
| 3434 | 3437 | - v20.0.0 | |
| 3435 | 3438 | - v19.9.0 | |
@@ -3517,6 +3520,9 @@ Emitted when code coverage is enabled and all tests have completed. | |||
| 3517 | 3520 | `undefined` if the test was run through the REPL. | |
| 3518 | 3521 | * `name` {string} The test name. | |
| 3519 | 3522 | * `nesting` {number} The nesting level of the test. | |
| 3523 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3524 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3525 | + when concurrent siblings at the same nesting level interleave. | ||
| 3520 | 3526 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3521 | 3527 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3522 | 3528 | See [Test tags][]. | |
@@ -3543,6 +3549,9 @@ The corresponding declaration ordered events are `'test:pass'` and `'test:fail'` | |||
| 3543 | 3549 | `undefined` if the test was run through the REPL. | |
| 3544 | 3550 | * `name` {string} The test name. | |
| 3545 | 3551 | * `nesting` {number} The nesting level of the test. | |
| 3552 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3553 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3554 | + when concurrent siblings at the same nesting level interleave. | ||
| 3546 | 3555 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3547 | 3556 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3548 | 3557 | See [Test tags][]. | |
@@ -3587,6 +3596,9 @@ defined. | |||
| 3587 | 3596 | `undefined` if the test was run through the REPL. | |
| 3588 | 3597 | * `name` {string} The test name. | |
| 3589 | 3598 | * `nesting` {number} The nesting level of the test. | |
| 3599 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3600 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3601 | + when concurrent siblings at the same nesting level interleave. | ||
| 3590 | 3602 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3591 | 3603 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3592 | 3604 | See [Test tags][]. | |
@@ -3616,6 +3628,9 @@ Emitted when a test is enqueued for execution. | |||
| 3616 | 3628 | `undefined` if the test was run through the REPL. | |
| 3617 | 3629 | * `name` {string} The test name. | |
| 3618 | 3630 | * `nesting` {number} The nesting level of the test. | |
| 3631 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3632 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3633 | + when concurrent siblings at the same nesting level interleave. | ||
| 3619 | 3634 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3620 | 3635 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3621 | 3636 | See [Test tags][]. | |
@@ -3676,6 +3691,9 @@ since the parent runner only knows about file-level tests. When using | |||
| 3676 | 3691 | `undefined` if the test was run through the REPL. | |
| 3677 | 3692 | * `name` {string} The test name. | |
| 3678 | 3693 | * `nesting` {number} The nesting level of the test. | |
| 3694 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3695 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3696 | + when concurrent siblings at the same nesting level interleave. | ||
| 3679 | 3697 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3680 | 3698 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3681 | 3699 | See [Test tags][]. | |
@@ -3718,6 +3736,9 @@ defined. | |||
| 3718 | 3736 | `undefined` if the test was run through the REPL. | |
| 3719 | 3737 | * `name` {string} The test name. | |
| 3720 | 3738 | * `nesting` {number} The nesting level of the test. | |
| 3739 | + * `parentId` {number|undefined} The `testId` of the enclosing test, or | ||
| 3740 | + `undefined` for top-level tests. Lets custom reporters track lineage | ||
| 3741 | + when concurrent siblings at the same nesting level interleave. | ||
| 3721 | 3742 | * `tags` {string\[]} The flattened lowercased tags declared on the test | |
| 3722 | 3743 | and its ancestor suites, in declaration order. Empty for untagged tests. | |
| 3723 | 3744 | See [Test tags][]. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -956,7 +956,7 @@ class Test extends AsyncResource { | |||
| 956 | 956 | const deferred = this.dequeuePendingSubtest(); | |
| 957 | 957 | const test = deferred.test; | |
| 958 | 958 | this.assignReportOrder(test); | |
| 959 | - test.reporter.dequeue(test.nesting, test.loc, test.name, this.reportedType, test.testId, test.tags); | ||
| 959 | + test.reporter.dequeue(test.nesting, test.loc, test.name, this.reportedType, test.testId, this.testId, test.tags); | ||
| 960 | 960 | await test.run(); | |
| 961 | 961 | deferred.resolve(); | |
| 962 | 962 | } | |
@@ -1213,7 +1213,8 @@ class Test extends AsyncResource { | |||
| 1213 | 1213 | // it. Otherwise, return a Promise to the caller and mark the test as | |
| 1214 | 1214 | // pending for later execution. | |
| 1215 | 1215 | this.parent.unfinishedSubtests.add(this); | |
| 1216 | - this.reporter.enqueue(this.nesting, this.loc, this.name, this.reportedType, this.testId, this.tags); | ||
| 1216 | + this.reporter.enqueue(this.nesting, this.loc, this.name, this.reportedType, | ||
| 1217 | + this.testId, this.parent?.testId, this.tags); | ||
| 1217 | 1218 | if (this.root.harness.buildPromise || !this.parent.hasConcurrency()) { | |
| 1218 | 1219 | const deferred = PromiseWithResolvers(); | |
| 1219 | 1220 | ||
@@ -1236,7 +1237,8 @@ class Test extends AsyncResource { | |||
| 1236 | 1237 | } | |
| 1237 | 1238 | ||
| 1238 | 1239 | this.parent.assignReportOrder(this); | |
| 1239 | - this.reporter.dequeue(this.nesting, this.loc, this.name, this.reportedType, this.testId, this.tags); | ||
| 1240 | + this.reporter.dequeue(this.nesting, this.loc, this.name, this.reportedType, | ||
| 1241 | + this.testId, this.parent?.testId, this.tags); | ||
| 1240 | 1242 | return this.run(); | |
| 1241 | 1243 | } | |
| 1242 | 1244 | ||
@@ -1510,7 +1512,7 @@ class Test extends AsyncResource { | |||
| 1510 | 1512 | this.testNumber ||= ++this.parent.outputSubtestCount; | |
| 1511 | 1513 | this.reporter.complete( | |
| 1512 | 1514 | this.nesting, this.loc, this.testNumber, this.name, | |
| 1513 | - report.details, report.directive, this.testId, this.tags, | ||
| 1515 | + report.details, report.directive, this.testId, this.parent?.testId, this.tags, | ||
| 1514 | 1516 | ); | |
| 1515 | 1517 | this.parent.activeSubtests--; | |
| 1516 | 1518 | } | |
@@ -1666,12 +1668,12 @@ class Test extends AsyncResource { | |||
| 1666 | 1668 | if (this.passed) { | |
| 1667 | 1669 | this.reporter.ok( | |
| 1668 | 1670 | this.nesting, this.loc, this.testNumber, this.name, | |
| 1669 | - report.details, report.directive, this.testId, this.tags, | ||
| 1671 | + report.details, report.directive, this.testId, this.parent?.testId, this.tags, | ||
| 1670 | 1672 | ); | |
| 1671 | 1673 | } else { | |
| 1672 | 1674 | this.reporter.fail( | |
| 1673 | 1675 | this.nesting, this.loc, this.testNumber, this.name, | |
| 1674 | - report.details, report.directive, this.testId, this.tags, | ||
| 1676 | + report.details, report.directive, this.testId, this.parent?.testId, this.tags, | ||
| 1675 | 1677 | ); | |
| 1676 | 1678 | } | |
| 1677 | 1679 | ||
@@ -1686,7 +1688,7 @@ class Test extends AsyncResource { | |||
| 1686 | 1688 | } | |
| 1687 | 1689 | this.#reportedSubtest = true; | |
| 1688 | 1690 | this.parent.reportStarted(); | |
| 1689 | - this.reporter.start(this.nesting, this.loc, this.name, this.testId, this.tags); | ||
| 1691 | + this.reporter.start(this.nesting, this.loc, this.name, this.testId, this.parent?.testId, this.tags); | ||
| 1690 | 1692 | } | |
| 1691 | 1693 | ||
| 1692 | 1694 | clearExecutionTime() { | |
@@ -1748,7 +1750,7 @@ class TestHook extends Test { | |||
| 1748 | 1750 | __proto__: null, | |
| 1749 | 1751 | duration_ms: this.duration(), | |
| 1750 | 1752 | error, | |
| 1751 | - }, undefined, undefined, parent.tags); | ||
| 1753 | + }, undefined, undefined, undefined, parent.tags); | ||
| 1752 | 1754 | } | |
| 1753 | 1755 | } | |
| 1754 | 1756 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,41 +35,44 @@ class TestsStream extends Readable { | |||
| 35 | 35 | } | |
| 36 | 36 | } | |
| 37 | 37 | ||
| 38 | - fail(nesting, loc, testNumber, name, details, directive, testId, tags) { | ||
| 38 | + fail(nesting, loc, testNumber, name, details, directive, testId, parentId, tags) { | ||
| 39 | 39 | this[kEmitMessage]('test:fail', { | |
| 40 | 40 | __proto__: null, | |
| 41 | 41 | name, | |
| 42 | 42 | nesting, | |
| 43 | 43 | testNumber, | |
| 44 | 44 | testId, | |
| 45 | + parentId, | ||
| 45 | 46 | details, | |
| 46 | 47 | tags: ArrayPrototypeSlice(tags), | |
| 47 | 48 | ...loc, | |
| 48 | 49 | ...directive, | |
| 49 | 50 | }); | |
| 50 | 51 | } | |
| 51 | 52 | ||
| 52 | - ok(nesting, loc, testNumber, name, details, directive, testId, tags) { | ||
| 53 | + ok(nesting, loc, testNumber, name, details, directive, testId, parentId, tags) { | ||
| 53 | 54 | this[kEmitMessage]('test:pass', { | |
| 54 | 55 | __proto__: null, | |
| 55 | 56 | name, | |
| 56 | 57 | nesting, | |
| 57 | 58 | testNumber, | |
| 58 | 59 | testId, | |
| 60 | + parentId, | ||
| 59 | 61 | details, | |
| 60 | 62 | tags: ArrayPrototypeSlice(tags), | |
| 61 | 63 | ...loc, | |
| 62 | 64 | ...directive, | |
| 63 | 65 | }); | |
| 64 | 66 | } | |
| 65 | 67 | ||
| 66 | - complete(nesting, loc, testNumber, name, details, directive, testId, tags) { | ||
| 68 | + complete(nesting, loc, testNumber, name, details, directive, testId, parentId, tags) { | ||
| 67 | 69 | this[kEmitMessage]('test:complete', { | |
| 68 | 70 | __proto__: null, | |
| 69 | 71 | name, | |
| 70 | 72 | nesting, | |
| 71 | 73 | testNumber, | |
| 72 | 74 | testId, | |
| 75 | + parentId, | ||
| 73 | 76 | details, | |
| 74 | 77 | tags: ArrayPrototypeSlice(tags), | |
| 75 | 78 | ...loc, | |
@@ -98,36 +101,39 @@ class TestsStream extends Readable { | |||
| 98 | 101 | return { __proto__: null, expectFailure: expectation ?? true }; | |
| 99 | 102 | } | |
| 100 | 103 | ||
| 101 | - enqueue(nesting, loc, name, type, testId, tags) { | ||
| 104 | + enqueue(nesting, loc, name, type, testId, parentId, tags) { | ||
| 102 | 105 | this[kEmitMessage]('test:enqueue', { | |
| 103 | 106 | __proto__: null, | |
| 104 | 107 | nesting, | |
| 105 | 108 | name, | |
| 106 | 109 | type, | |
| 107 | 110 | testId, | |
| 111 | + parentId, | ||
| 108 | 112 | tags: ArrayPrototypeSlice(tags), | |
| 109 | 113 | ...loc, | |
| 110 | 114 | }); | |
| 111 | 115 | } | |
| 112 | 116 | ||
| 113 | - dequeue(nesting, loc, name, type, testId, tags) { | ||
| 117 | + dequeue(nesting, loc, name, type, testId, parentId, tags) { | ||
| 114 | 118 | this[kEmitMessage]('test:dequeue', { | |
| 115 | 119 | __proto__: null, | |
| 116 | 120 | nesting, | |
| 117 | 121 | name, | |
| 118 | 122 | type, | |
| 119 | 123 | testId, | |
| 124 | + parentId, | ||
| 120 | 125 | tags: ArrayPrototypeSlice(tags), | |
| 121 | 126 | ...loc, | |
| 122 | 127 | }); | |
| 123 | 128 | } | |
| 124 | 129 | ||
| 125 | - start(nesting, loc, name, testId, tags) { | ||
| 130 | + start(nesting, loc, name, testId, parentId, tags) { | ||
| 126 | 131 | this[kEmitMessage]('test:start', { | |
| 127 | 132 | __proto__: null, | |
| 128 | 133 | nesting, | |
| 129 | 134 | name, | |
| 130 | 135 | testId, | |
| 136 | + parentId, | ||
| 131 | 137 | tags: ArrayPrototypeSlice(tags), | |
| 132 | 138 | ...loc, | |
| 133 | 139 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments