Skip to content

Commit d7303e8

Browse files
dreamorosisvozza
andauthored
chore: upgrade vitest & update coverage exceptions (#4747)
Co-authored-by: Stefano Vozza <[email protected]>
1 parent 93c4ed7 commit d7303e8

File tree

37 files changed

+576
-339
lines changed

37 files changed

+576
-339
lines changed

package-lock.json

Lines changed: 503 additions & 284 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@biomejs/biome": "^2.3.5",
5454
"@types/aws-lambda": "^8.10.158",
5555
"@types/node": "^24.10.1",
56-
"@vitest/coverage-v8": "^3.2.4",
56+
"@vitest/coverage-v8": "^4.0.9",
5757
"husky": "^9.1.7",
5858
"lint-staged": "^16.2.5",
5959
"markdownlint-cli2": "^0.19.0",
@@ -62,7 +62,7 @@
6262
"typedoc": "^0.28.14",
6363
"typedoc-plugin-missing-exports": "^4.1.2",
6464
"typescript": "^5.9.3",
65-
"vitest": "^3.0.9"
65+
"vitest": "^4.0.9"
6666
},
6767
"lint-staged": {
6868
"*.{js,ts,json}": "biome check --write --no-errors-on-unmatched",

packages/batch/src/BasePartialBatchProcessor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ abstract class BasePartialBatchProcessor extends BasePartialProcessor {
117117

118118
for (const msg of this.failureMessages) {
119119
const msgId = (msg as DynamoDBRecord).dynamodb?.SequenceNumber;
120+
/* v8 ignore else -- @preserve */
120121
if (msgId) {
121122
failures.push({ itemIdentifier: msgId });
122123
}

packages/batch/src/BatchProcessorSync.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ import type { BaseRecord, FailureResponse, SuccessResponse } from './types.js';
8282
* @param eventType The type of event to process (SQS, Kinesis, DynamoDB)
8383
* @deprecated Use {@link BasePartialBatchProcessor} instead, this class is deprecated and will be removed in the next major version.
8484
*/
85-
/* v8 ignore start */ class BatchProcessorSync extends BasePartialBatchProcessor {
85+
/* v8 ignore next -- @preserve */ class BatchProcessorSync extends BasePartialBatchProcessor {
8686
/**
8787
* @throws {BatchProcessingError} This method is not implemented for asynchronous processing.
8888
*
8989
* @param _record The record to be processed
9090
*/
91-
public processRecord(
91+
/* v8 ignore next -- @preserve */ public processRecord(
9292
_record: BaseRecord
9393
): Promise<SuccessResponse | FailureResponse> {
9494
throw new BatchProcessingError('Not implemented. Use process() instead.');
@@ -120,6 +120,6 @@ import type { BaseRecord, FailureResponse, SuccessResponse } from './types.js';
120120
return this.failureHandler(record, error as Error);
121121
}
122122
}
123-
} /* v8 ignore stop */
123+
}
124124

125125
export { BatchProcessorSync };

packages/batch/src/processPartialResponseSync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ import type {
9999
* @param processor Batch processor instance to handle the batch processing
100100
* @param options Batch processing options, which can vary with chosen batch processor implementation
101101
*/
102-
/* v8 ignore start */ const processPartialResponseSync = <
102+
/* v8 ignore next -- @preserve */ const processPartialResponseSync = <
103103
T extends BasePartialBatchProcessor,
104104
>(
105105
event: { Records: BaseRecord[] },
@@ -116,6 +116,6 @@ import type {
116116
processor.processSync();
117117

118118
return processor.response();
119-
}; /* v8 ignore stop */
119+
};
120120

121121
export { processPartialResponseSync };

packages/commons/src/LRUCache.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class LRUCache<K, V> {
215215
if (this.mostRecentlyUsed === item) return;
216216

217217
// If the item is not the newest, we need to mark it as the newest
218+
/* v8 ignore else -- @preserve */
218219
if (item[NEWER]) {
219220
if (item === this.leastRecentlyUsed) {
220221
this.leastRecentlyUsed = item[NEWER];
@@ -226,6 +227,7 @@ class LRUCache<K, V> {
226227
}
227228
item[NEWER] = undefined;
228229
item[OLDER] = this.mostRecentlyUsed;
230+
/* v8 ignore else -- @preserve */
229231
if (this.mostRecentlyUsed) {
230232
this.mostRecentlyUsed[NEWER] = item;
231233
}

packages/commons/src/awsSdkUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ const customUserAgentMiddleware = (feature: string) => {
8080
const hasPowertools = (middlewareStack: string[]): boolean => {
8181
let found = false;
8282
for (const middleware of middlewareStack) {
83+
/* v8 ignore else -- @preserve */
8384
if (middleware.includes('addPowertoolsToUserAgent')) {
8485
found = true;
8586
}

packages/event-handler/src/appsync-events/RouteHandlerRegistry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class RouteHandlerRegistry {
115115
}
116116
}
117117
if (mostSpecificHandler === undefined) {
118+
/* v8 ignore else -- @preserve */
118119
if (!this.#warningSet.has(path)) {
119120
this.#logger.warn(
120121
`No route handler found for path '${path}' registered for ${this.#eventType}.`

packages/event-handler/src/appsync-events/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const isAppSyncEventsEvent = (event: unknown): event is AppSyncEventsEvent => {
3838
'name' in event.info.channelNamespace &&
3939
isString(event.info.channelNamespace.name) &&
4040
'operation' in event.info &&
41-
/* v8 ignore next */
42-
(event.info.operation === 'PUBLISH' || event.info.operation === 'SUBSCRIBE')
41+
isString(event.info.operation) &&
42+
['PUBLISH', 'SUBSCRIBE'].includes(event.info.operation)
4343
);
4444
};
4545

packages/event-handler/src/rest/converters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ function addProxyEventHeaders(
322322
response: ExtendedAPIGatewayProxyResult
323323
) {
324324
for (const [key, value] of Object.entries(response.headers ?? {})) {
325+
/* v8 ignore else -- @preserve */
325326
if (value != null) {
326327
headers.set(key, String(value));
327328
}

0 commit comments

Comments
 (0)