velocious 1.0.649 → 1.0.651
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/build/database/record/counter-cache-magnitude.js +14 -3
- package/build/database/record/counter-cache-parent-updates.js +137 -0
- package/build/database/record/index.js +13 -3
- package/build/frontend-models/websocket-publishers.js +35 -12
- package/build/http-client/websocket-client.js +38 -6
- package/build/src/database/record/counter-cache-magnitude.d.ts.map +1 -1
- package/build/src/database/record/counter-cache-magnitude.js +14 -4
- package/build/src/database/record/counter-cache-parent-updates.d.ts +43 -0
- package/build/src/database/record/counter-cache-parent-updates.d.ts.map +1 -0
- package/build/src/database/record/counter-cache-parent-updates.js +125 -0
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +14 -4
- package/build/src/frontend-models/websocket-publishers.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-publishers.js +32 -13
- package/build/src/http-client/websocket-client.d.ts.map +1 -1
- package/build/src/http-client/websocket-client.js +39 -7
- package/build/src/testing/test-runner.d.ts +8 -3
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +6 -5
- package/build/src/testing/velocious-runner-reporter.d.ts +1 -1
- package/build/src/testing/velocious-runner-reporter.d.ts.map +1 -1
- package/build/src/testing/velocious-runner-reporter.js +22 -2
- package/build/testing/test-runner.js +6 -4
- package/build/testing/velocious-runner-reporter.js +23 -1
- package/package.json +1 -1
- package/src/database/record/counter-cache-magnitude.js +14 -3
- package/src/database/record/counter-cache-parent-updates.js +137 -0
- package/src/database/record/index.js +13 -3
- package/src/frontend-models/websocket-publishers.js +35 -12
- package/src/http-client/websocket-client.js +38 -6
- package/src/testing/test-runner.js +6 -4
- package/src/testing/velocious-runner-reporter.js +23 -1
|
@@ -118,19 +118,51 @@ export default class VelociousWebsocketClient extends SnapReqWebSocketClient {
|
|
|
118
118
|
if (this.gracefulClosePromise) return await this.gracefulClosePromise
|
|
119
119
|
|
|
120
120
|
this.autoReconnect = false
|
|
121
|
+
const channelSubscriptions = [...this._channelSubscriptions.values()]
|
|
121
122
|
const socket = this.socket
|
|
123
|
+
|
|
124
|
+
this._channelSubscriptions.clear()
|
|
125
|
+
const {promise: publishedClosePromise, reject: rejectPublishedClose, resolve: resolvePublishedClose} = Promise.withResolvers()
|
|
126
|
+
|
|
127
|
+
this.gracefulClosePromise = publishedClosePromise
|
|
128
|
+
// This internal bridge exists only for synchronous reentrancy. Its rejection
|
|
129
|
+
// duplicates closePromise, which remains the public error source below.
|
|
130
|
+
void publishedClosePromise.catch(() => {})
|
|
122
131
|
const closePromise = (async () => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
/** @type {unknown[]} */
|
|
133
|
+
const closeErrors = []
|
|
134
|
+
|
|
135
|
+
for (const subscription of channelSubscriptions) {
|
|
136
|
+
try {
|
|
137
|
+
subscription._handleClosed("client_close")
|
|
138
|
+
} catch (error) {
|
|
139
|
+
closeErrors.push(error)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
if (socket && socket.readyState === socket.OPEN) {
|
|
145
|
+
await new Promise((resolve) => {
|
|
146
|
+
socket.addEventListener("close", () => resolve(undefined), {once: true})
|
|
147
|
+
socket.close(1000)
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
} catch (error) {
|
|
151
|
+
closeErrors.push(error)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
await super.close()
|
|
156
|
+
} catch (error) {
|
|
157
|
+
closeErrors.push(error)
|
|
128
158
|
}
|
|
129
159
|
|
|
130
|
-
|
|
160
|
+
if (closeErrors.length === 1) throw closeErrors[0]
|
|
161
|
+
if (closeErrors.length > 1) throw new AggregateError(closeErrors, "Failed to close WebSocket client")
|
|
131
162
|
})()
|
|
132
163
|
|
|
133
164
|
this.gracefulClosePromise = closePromise
|
|
165
|
+
void closePromise.then(resolvePublishedClose, rejectPublishedClose)
|
|
134
166
|
|
|
135
167
|
try {
|
|
136
168
|
await closePromise
|
|
@@ -1484,13 +1484,15 @@ export default class TestRunner {
|
|
|
1484
1484
|
recordSuiteHookFailure(failure) { this._suiteHookFailures.push(failure) }
|
|
1485
1485
|
|
|
1486
1486
|
/**
|
|
1487
|
-
* Gets the raw ancestor setup failure for a package test.
|
|
1487
|
+
* Gets the raw ancestor setup failure outcome for a package test.
|
|
1488
1488
|
* @param {PackageTestDeclaration} test - Package test declaration.
|
|
1489
|
-
* @returns {ReturnType<typeof JSON.parse>} - Raw setup failure.
|
|
1489
|
+
* @returns {{failed: false} | {failed: true, error: ReturnType<typeof JSON.parse>}} - Raw setup failure outcome.
|
|
1490
1490
|
*/
|
|
1491
|
-
|
|
1491
|
+
setupFailureOutcomeFor(test) {
|
|
1492
1492
|
const suites = this.testMetadata(test).suites
|
|
1493
|
-
|
|
1493
|
+
const failure = this._suiteHookFailures.find((entry) => entry.phase === "beforeAll" && suites.includes(entry.suite))
|
|
1494
|
+
|
|
1495
|
+
return failure ? {failed: true, error: failure.error} : {failed: false}
|
|
1494
1496
|
}
|
|
1495
1497
|
|
|
1496
1498
|
/**
|
|
@@ -7,6 +7,23 @@ import restArgsError from "../utils/rest-args-error.js"
|
|
|
7
7
|
import { testEvents } from "./test.js"
|
|
8
8
|
|
|
9
9
|
/** @typedef {import("@velocious/testing/runner").TestDeclaration} PackageTestDeclaration */
|
|
10
|
+
/** @typedef {import("@velocious/testing/runner").TestErrorRecord} PackageTestErrorRecord */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Restores the Error shape serialized by the package runner.
|
|
14
|
+
* @param {PackageTestErrorRecord} errorRecord - Serialized package failure.
|
|
15
|
+
* @returns {Error} - Error compatible with Velocious's legacy reporter contract.
|
|
16
|
+
*/
|
|
17
|
+
function errorFromPackageRecord(errorRecord) {
|
|
18
|
+
const error = errorRecord.errors
|
|
19
|
+
? new AggregateError(errorRecord.errors.map(errorFromPackageRecord), errorRecord.message)
|
|
20
|
+
: new Error(errorRecord.message)
|
|
21
|
+
|
|
22
|
+
error.name = errorRecord.name
|
|
23
|
+
if (errorRecord.stack) error.stack = errorRecord.stack
|
|
24
|
+
|
|
25
|
+
return error
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
/** Stops package traversal after framework-owned connection quarantine. */
|
|
12
29
|
export class AbortRemainingTestsError extends Error {}
|
|
@@ -186,9 +203,14 @@ export default class VelociousRunnerReporter {
|
|
|
186
203
|
const outcome = finalAttempt
|
|
187
204
|
? this.testRunner.attemptOutcome(test, finalAttempt.attemptNumber)
|
|
188
205
|
: undefined
|
|
206
|
+
const setupFailure = this.testRunner.setupFailureOutcomeFor(test)
|
|
189
207
|
const error = outcome?.failed
|
|
190
208
|
? outcome.error
|
|
191
|
-
:
|
|
209
|
+
: setupFailure.failed
|
|
210
|
+
? setupFailure.error
|
|
211
|
+
: packageTestResult.error
|
|
212
|
+
? errorFromPackageRecord(packageTestResult.error)
|
|
213
|
+
: undefined
|
|
192
214
|
|
|
193
215
|
await this.reportFailedTest({
|
|
194
216
|
attemptConsoleOutputs: this.attemptConsoleOutputs.get(test) || [],
|