| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3aca628 commit 839a06e
47 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2951,6 +2951,7 @@ The corresponding declaration ordered events are `'test:pass'` and `'test:fail'` | |||
| 2951 | 2951 | `undefined` if the test was run through the REPL. | |
| 2952 | 2952 | * `name` {string} The test name. | |
| 2953 | 2953 | * `nesting` {number} The nesting level of the test. | |
| 2954 | + * `type` {string} The test type. Either `'suite'` or `'test'`. | ||
| 2954 | 2955 | ||
| 2955 | 2956 | Emitted when a test is dequeued, right before it is executed. | |
| 2956 | 2957 | This event is not guaranteed to be emitted in the same order as the tests are | |
@@ -2983,6 +2984,7 @@ defined. | |||
| 2983 | 2984 | `undefined` if the test was run through the REPL. | |
| 2984 | 2985 | * `name` {string} The test name. | |
| 2985 | 2986 | * `nesting` {number} The nesting level of the test. | |
| 2987 | + * `type` {string} The test type. Either `'suite'` or `'test'`. | ||
| 2986 | 2988 | ||
| 2987 | 2989 | Emitted when a test is enqueued for execution. | |
| 2988 | 2990 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -363,6 +363,7 @@ class SuiteContext { | |||
| 363 | 363 | } | |
| 364 | 364 | ||
| 365 | 365 | class Test extends AsyncResource { | |
| 366 | + reportedType = 'test'; | ||
| 366 | 367 | abortController; | |
| 367 | 368 | outerSignal; | |
| 368 | 369 | #reportedSubtest; | |
@@ -609,7 +610,7 @@ class Test extends AsyncResource { | |||
| 609 | 610 | while (this.pendingSubtests.length > 0 && this.hasConcurrency()) { | |
| 610 | 611 | const deferred = ArrayPrototypeShift(this.pendingSubtests); | |
| 611 | 612 | const test = deferred.test; | |
| 612 | - test.reporter.dequeue(test.nesting, test.loc, test.name); | ||
| 613 | + test.reporter.dequeue(test.nesting, test.loc, test.name, this.reportedType); | ||
| 613 | 614 | await test.run(); | |
| 614 | 615 | deferred.resolve(); | |
| 615 | 616 | } | |
@@ -800,7 +801,7 @@ class Test extends AsyncResource { | |||
| 800 | 801 | // If there is enough available concurrency to run the test now, then do | |
| 801 | 802 | // it. Otherwise, return a Promise to the caller and mark the test as | |
| 802 | 803 | // pending for later execution. | |
| 803 | - this.reporter.enqueue(this.nesting, this.loc, this.name); | ||
| 804 | + this.reporter.enqueue(this.nesting, this.loc, this.name, this.reportedType); | ||
| 804 | 805 | if (this.root.harness.buildPromise || !this.parent.hasConcurrency()) { | |
| 805 | 806 | const deferred = PromiseWithResolvers(); | |
| 806 | 807 | ||
@@ -809,7 +810,7 @@ class Test extends AsyncResource { | |||
| 809 | 810 | return deferred.promise; | |
| 810 | 811 | } | |
| 811 | 812 | ||
| 812 | - this.reporter.dequeue(this.nesting, this.loc, this.name); | ||
| 813 | + this.reporter.dequeue(this.nesting, this.loc, this.name, this.reportedType); | ||
| 813 | 814 | return this.run(); | |
| 814 | 815 | } | |
| 815 | 816 | ||
@@ -1179,6 +1180,7 @@ class Test extends AsyncResource { | |||
| 1179 | 1180 | } | |
| 1180 | 1181 | ||
| 1181 | 1182 | class TestHook extends Test { | |
| 1183 | + reportedType = 'hook'; | ||
| 1182 | 1184 | #args; | |
| 1183 | 1185 | constructor(fn, options) { | |
| 1184 | 1186 | const { hookType, loc, parent, timeout, signal } = options; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,20 +87,22 @@ class TestsStream extends Readable { | |||
| 87 | 87 | return { __proto__: null, todo: reason ?? true }; | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | - enqueue(nesting, loc, name) { | ||
| 90 | + enqueue(nesting, loc, name, type) { | ||
| 91 | 91 | this[kEmitMessage]('test:enqueue', { | |
| 92 | 92 | __proto__: null, | |
| 93 | 93 | nesting, | |
| 94 | 94 | name, | |
| 95 | + type, | ||
| 95 | 96 | ...loc, | |
| 96 | 97 | }); | |
| 97 | 98 | } | |
| 98 | 99 | ||
| 99 | - dequeue(nesting, loc, name) { | ||
| 100 | + dequeue(nesting, loc, name, type) { | ||
| 100 | 101 | this[kEmitMessage]('test:dequeue', { | |
| 101 | 102 | __proto__: null, | |
| 102 | 103 | nesting, | |
| 103 | 104 | name, | |
| 105 | + type, | ||
| 104 | 106 | ...loc, | |
| 105 | 107 | }); | |
| 106 | 108 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const {test, suite} = require('node:test'); | ||
| 3 | + | ||
| 4 | + suite('this is a suite'); | ||
| 5 | + test('this is a test'); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ AFTER | |||
| 4 | 4 | not ok 1 - test that aborts | |
| 5 | 5 | --- | |
| 6 | 6 | duration_ms: * | |
| 7 | + type: 'test' | ||
| 7 | 8 | location: '/test/fixtures/test-runner/output/abort-runs-after-hook.js:(LINE):1' | |
| 8 | 9 | failureType: 'uncaughtException' | |
| 9 | 10 | error: 'boom' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,26 +4,31 @@ TAP version 13 | |||
| 4 | 4 | ok 1 - ok 1 | |
| 5 | 5 | --- | |
| 6 | 6 | duration_ms: * | |
| 7 | + type: 'test' | ||
| 7 | 8 | ... | |
| 8 | 9 | # Subtest: ok 2 | |
| 9 | 10 | ok 2 - ok 2 | |
| 10 | 11 | --- | |
| 11 | 12 | duration_ms: * | |
| 13 | + type: 'test' | ||
| 12 | 14 | ... | |
| 13 | 15 | # Subtest: ok 3 | |
| 14 | 16 | ok 3 - ok 3 | |
| 15 | 17 | --- | |
| 16 | 18 | duration_ms: * | |
| 19 | + type: 'test' | ||
| 17 | 20 | ... | |
| 18 | 21 | # Subtest: ok 4 | |
| 19 | 22 | ok 4 - ok 4 | |
| 20 | 23 | --- | |
| 21 | 24 | duration_ms: * | |
| 25 | + type: 'test' | ||
| 22 | 26 | ... | |
| 23 | 27 | # Subtest: not ok 1 | |
| 24 | 28 | not ok 5 - not ok 1 | |
| 25 | 29 | --- | |
| 26 | 30 | duration_ms: * | |
| 31 | + type: 'test' | ||
| 27 | 32 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' | |
| 28 | 33 | failureType: 'cancelledByParent' | |
| 29 | 34 | error: 'test did not finish before its parent and was cancelled' | |
@@ -33,6 +38,7 @@ TAP version 13 | |||
| 33 | 38 | not ok 6 - not ok 2 | |
| 34 | 39 | --- | |
| 35 | 40 | duration_ms: * | |
| 41 | + type: 'test' | ||
| 36 | 42 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' | |
| 37 | 43 | failureType: 'cancelledByParent' | |
| 38 | 44 | error: 'test did not finish before its parent and was cancelled' | |
@@ -42,6 +48,7 @@ TAP version 13 | |||
| 42 | 48 | not ok 7 - not ok 3 | |
| 43 | 49 | --- | |
| 44 | 50 | duration_ms: * | |
| 51 | + type: 'test' | ||
| 45 | 52 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' | |
| 46 | 53 | failureType: 'testAborted' | |
| 47 | 54 | error: 'This operation was aborted' | |
@@ -63,6 +70,7 @@ TAP version 13 | |||
| 63 | 70 | not ok 8 - not ok 4 | |
| 64 | 71 | --- | |
| 65 | 72 | duration_ms: * | |
| 73 | + type: 'test' | ||
| 66 | 74 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' | |
| 67 | 75 | failureType: 'testAborted' | |
| 68 | 76 | error: 'This operation was aborted' | |
@@ -84,6 +92,7 @@ TAP version 13 | |||
| 84 | 92 | not ok 9 - not ok 5 | |
| 85 | 93 | --- | |
| 86 | 94 | duration_ms: * | |
| 95 | + type: 'test' | ||
| 87 | 96 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):7' | |
| 88 | 97 | failureType: 'testAborted' | |
| 89 | 98 | error: 'This operation was aborted' | |
@@ -105,6 +114,7 @@ TAP version 13 | |||
| 105 | 114 | not ok 1 - promise timeout signal | |
| 106 | 115 | --- | |
| 107 | 116 | duration_ms: * | |
| 117 | + type: 'test' | ||
| 108 | 118 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):1' | |
| 109 | 119 | failureType: 'testAborted' | |
| 110 | 120 | error: 'The operation was aborted due to timeout' | |
@@ -120,6 +130,7 @@ not ok 1 - promise timeout signal | |||
| 120 | 130 | not ok 2 - promise abort signal | |
| 121 | 131 | --- | |
| 122 | 132 | duration_ms: * | |
| 133 | + type: 'test' | ||
| 123 | 134 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):1' | |
| 124 | 135 | failureType: 'testAborted' | |
| 125 | 136 | error: 'This operation was aborted' | |
@@ -142,26 +153,31 @@ not ok 2 - promise abort signal | |||
| 142 | 153 | ok 1 - ok 1 | |
| 143 | 154 | --- | |
| 144 | 155 | duration_ms: * | |
| 156 | + type: 'test' | ||
| 145 | 157 | ... | |
| 146 | 158 | # Subtest: ok 2 | |
| 147 | 159 | ok 2 - ok 2 | |
| 148 | 160 | --- | |
| 149 | 161 | duration_ms: * | |
| 162 | + type: 'test' | ||
| 150 | 163 | ... | |
| 151 | 164 | # Subtest: ok 3 | |
| 152 | 165 | ok 3 - ok 3 | |
| 153 | 166 | --- | |
| 154 | 167 | duration_ms: * | |
| 168 | + type: 'test' | ||
| 155 | 169 | ... | |
| 156 | 170 | # Subtest: ok 4 | |
| 157 | 171 | ok 4 - ok 4 | |
| 158 | 172 | --- | |
| 159 | 173 | duration_ms: * | |
| 174 | + type: 'test' | ||
| 160 | 175 | ... | |
| 161 | 176 | # Subtest: not ok 1 | |
| 162 | 177 | not ok 5 - not ok 1 | |
| 163 | 178 | --- | |
| 164 | 179 | duration_ms: * | |
| 180 | + type: 'test' | ||
| 165 | 181 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' | |
| 166 | 182 | failureType: 'cancelledByParent' | |
| 167 | 183 | error: 'test did not finish before its parent and was cancelled' | |
@@ -171,6 +187,7 @@ not ok 2 - promise abort signal | |||
| 171 | 187 | not ok 6 - not ok 2 | |
| 172 | 188 | --- | |
| 173 | 189 | duration_ms: * | |
| 190 | + type: 'test' | ||
| 174 | 191 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' | |
| 175 | 192 | failureType: 'cancelledByParent' | |
| 176 | 193 | error: 'test did not finish before its parent and was cancelled' | |
@@ -180,6 +197,7 @@ not ok 2 - promise abort signal | |||
| 180 | 197 | not ok 7 - not ok 3 | |
| 181 | 198 | --- | |
| 182 | 199 | duration_ms: * | |
| 200 | + type: 'test' | ||
| 183 | 201 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' | |
| 184 | 202 | failureType: 'testAborted' | |
| 185 | 203 | error: 'This operation was aborted' | |
@@ -201,6 +219,7 @@ not ok 2 - promise abort signal | |||
| 201 | 219 | not ok 8 - not ok 4 | |
| 202 | 220 | --- | |
| 203 | 221 | duration_ms: * | |
| 222 | + type: 'test' | ||
| 204 | 223 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' | |
| 205 | 224 | failureType: 'testAborted' | |
| 206 | 225 | error: 'This operation was aborted' | |
@@ -222,6 +241,7 @@ not ok 2 - promise abort signal | |||
| 222 | 241 | not ok 9 - not ok 5 | |
| 223 | 242 | --- | |
| 224 | 243 | duration_ms: * | |
| 244 | + type: 'test' | ||
| 225 | 245 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):5' | |
| 226 | 246 | failureType: 'testAborted' | |
| 227 | 247 | error: 'This operation was aborted' | |
@@ -243,6 +263,7 @@ not ok 2 - promise abort signal | |||
| 243 | 263 | not ok 3 - callback timeout signal | |
| 244 | 264 | --- | |
| 245 | 265 | duration_ms: * | |
| 266 | + type: 'test' | ||
| 246 | 267 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):1' | |
| 247 | 268 | failureType: 'testAborted' | |
| 248 | 269 | error: 'The operation was aborted due to timeout' | |
@@ -258,6 +279,7 @@ not ok 3 - callback timeout signal | |||
| 258 | 279 | not ok 4 - callback abort signal | |
| 259 | 280 | --- | |
| 260 | 281 | duration_ms: * | |
| 282 | + type: 'test' | ||
| 261 | 283 | location: '/test/fixtures/test-runner/output/abort.js:(LINE):1' | |
| 262 | 284 | failureType: 'testAborted' | |
| 263 | 285 | error: 'This operation was aborted' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ TAP version 13 | |||
| 12 | 12 | not ok 1 - test 1 | |
| 13 | 13 | --- | |
| 14 | 14 | duration_ms: * | |
| 15 | + type: 'test' | ||
| 15 | 16 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 16 | 17 | failureType: 'cancelledByParent' | |
| 17 | 18 | error: 'test did not finish before its parent and was cancelled' | |
@@ -21,6 +22,7 @@ TAP version 13 | |||
| 21 | 22 | not ok 2 - test 2 | |
| 22 | 23 | --- | |
| 23 | 24 | duration_ms: * | |
| 25 | + type: 'test' | ||
| 24 | 26 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 25 | 27 | failureType: 'cancelledByParent' | |
| 26 | 28 | error: 'test did not finish before its parent and was cancelled' | |
@@ -53,11 +55,13 @@ not ok 1 - 1 before describe | |||
| 53 | 55 | ok 1 - test 1 | |
| 54 | 56 | --- | |
| 55 | 57 | duration_ms: * | |
| 58 | + type: 'test' | ||
| 56 | 59 | ... | |
| 57 | 60 | # Subtest: test 2 | |
| 58 | 61 | ok 2 - test 2 | |
| 59 | 62 | --- | |
| 60 | 63 | duration_ms: * | |
| 64 | + type: 'test' | ||
| 61 | 65 | ... | |
| 62 | 66 | 1..2 | |
| 63 | 67 | not ok 2 - 2 after describe | |
@@ -86,6 +90,7 @@ not ok 2 - 2 after describe | |||
| 86 | 90 | not ok 1 - test 1 | |
| 87 | 91 | --- | |
| 88 | 92 | duration_ms: * | |
| 93 | + type: 'test' | ||
| 89 | 94 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 90 | 95 | failureType: 'hookFailed' | |
| 91 | 96 | error: 'This operation was aborted' | |
@@ -107,6 +112,7 @@ not ok 2 - 2 after describe | |||
| 107 | 112 | not ok 2 - test 2 | |
| 108 | 113 | --- | |
| 109 | 114 | duration_ms: * | |
| 115 | + type: 'test' | ||
| 110 | 116 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 111 | 117 | failureType: 'hookFailed' | |
| 112 | 118 | error: 'This operation was aborted' | |
@@ -139,6 +145,7 @@ not ok 3 - 3 beforeEach describe | |||
| 139 | 145 | not ok 1 - test 1 | |
| 140 | 146 | --- | |
| 141 | 147 | duration_ms: * | |
| 148 | + type: 'test' | ||
| 142 | 149 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 143 | 150 | failureType: 'hookFailed' | |
| 144 | 151 | error: 'This operation was aborted' | |
@@ -160,6 +167,7 @@ not ok 3 - 3 beforeEach describe | |||
| 160 | 167 | not ok 2 - test 2 | |
| 161 | 168 | --- | |
| 162 | 169 | duration_ms: * | |
| 170 | + type: 'test' | ||
| 163 | 171 | location: '/test/fixtures/test-runner/output/abort_hooks.js:(LINE):3' | |
| 164 | 172 | failureType: 'hookFailed' | |
| 165 | 173 | error: 'This operation was aborted' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,26 +4,31 @@ TAP version 13 | |||
| 4 | 4 | ok 1 - ok 1 | |
| 5 | 5 | --- | |
| 6 | 6 | duration_ms: * | |
| 7 | + type: 'test' | ||
| 7 | 8 | ... | |
| 8 | 9 | # Subtest: ok 2 | |
| 9 | 10 | ok 2 - ok 2 | |
| 10 | 11 | --- | |
| 11 | 12 | duration_ms: * | |
| 13 | + type: 'test' | ||
| 12 | 14 | ... | |
| 13 | 15 | # Subtest: ok 3 | |
| 14 | 16 | ok 3 - ok 3 | |
| 15 | 17 | --- | |
| 16 | 18 | duration_ms: * | |
| 19 | + type: 'test' | ||
| 17 | 20 | ... | |
| 18 | 21 | # Subtest: ok 4 | |
| 19 | 22 | ok 4 - ok 4 | |
| 20 | 23 | --- | |
| 21 | 24 | duration_ms: * | |
| 25 | + type: 'test' | ||
| 22 | 26 | ... | |
| 23 | 27 | # Subtest: not ok 1 | |
| 24 | 28 | not ok 5 - not ok 1 | |
| 25 | 29 | --- | |
| 26 | 30 | duration_ms: * | |
| 31 | + type: 'test' | ||
| 27 | 32 | location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' | |
| 28 | 33 | failureType: 'cancelledByParent' | |
| 29 | 34 | error: 'test did not finish before its parent and was cancelled' | |
@@ -33,6 +38,7 @@ TAP version 13 | |||
| 33 | 38 | not ok 6 - not ok 2 | |
| 34 | 39 | --- | |
| 35 | 40 | duration_ms: * | |
| 41 | + type: 'test' | ||
| 36 | 42 | location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' | |
| 37 | 43 | failureType: 'cancelledByParent' | |
| 38 | 44 | error: 'test did not finish before its parent and was cancelled' | |
@@ -42,6 +48,7 @@ TAP version 13 | |||
| 42 | 48 | not ok 7 - not ok 3 | |
| 43 | 49 | --- | |
| 44 | 50 | duration_ms: * | |
| 51 | + type: 'test' | ||
| 45 | 52 | location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' | |
| 46 | 53 | failureType: 'testAborted' | |
| 47 | 54 | error: 'This operation was aborted' | |
@@ -63,6 +70,7 @@ TAP version 13 | |||
| 63 | 70 | not ok 8 - not ok 4 | |
| 64 | 71 | --- | |
| 65 | 72 | duration_ms: * | |
| 73 | + type: 'test' | ||
| 66 | 74 | location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' | |
| 67 | 75 | failureType: 'testAborted' | |
| 68 | 76 | error: 'This operation was aborted' | |
@@ -84,6 +92,7 @@ TAP version 13 | |||
| 84 | 92 | not ok 9 - not ok 5 | |
| 85 | 93 | --- | |
| 86 | 94 | duration_ms: * | |
| 95 | + type: 'test' | ||
| 87 | 96 | location: '/test/fixtures/test-runner/output/abort_suite.js:(LINE):3' | |
| 88 | 97 | failureType: 'testAborted' | |
| 89 | 98 | error: 'This operation was aborted' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,6 +16,7 @@ TAP version 13 | |||
| 16 | 16 | ok 1 - passing test | |
| 17 | 17 | --- | |
| 18 | 18 | duration_ms: * | |
| 19 | + type: 'test' | ||
| 19 | 20 | ... | |
| 20 | 21 | 1..1 | |
| 21 | 22 | # tests 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments