From 2e3bd770a474ba09f418a15e716170cf669eff2d Mon Sep 17 00:00:00 2001 From: Jared Wray Date: Sat, 15 Nov 2025 10:54:50 -0800 Subject: [PATCH] node-cache - chore: upgrading vitest to 4.0.9 --- packages/node-cache/package.json | 4 ++-- packages/node-cache/src/index.ts | 10 ++++++---- packages/node-cache/src/store.ts | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/node-cache/package.json b/packages/node-cache/package.json index 116ad177..931e449e 100644 --- a/packages/node-cache/package.json +++ b/packages/node-cache/package.json @@ -45,11 +45,11 @@ "@biomejs/biome": "^2.3.5", "@faker-js/faker": "^10.1.0", "@types/node": "^24.10.1", - "@vitest/coverage-v8": "^3.2.4", + "@vitest/coverage-v8": "^4.0.9", "rimraf": "^6.1.0", "tsup": "^8.5.1", "typescript": "^5.9.3", - "vitest": "^3.2.4" + "vitest": "^4.0.9" }, "dependencies": { "cacheable": "workspace:^", diff --git a/packages/node-cache/src/index.ts b/packages/node-cache/src/index.ts index fe769919..fe3a61b0 100644 --- a/packages/node-cache/src/index.ts +++ b/packages/node-cache/src/index.ts @@ -122,13 +122,13 @@ export class NodeCache extends Hookified { ttl: number | string = 0, ): boolean { // Check on key type - /* c8 ignore next 3 */ + /* v8 ignore next -- @preserve */ if (typeof key !== "string" && typeof key !== "number") { throw this.createError(NodeCacheErrors.EKEYTYPE, key); } // Check on ttl type - /* c8 ignore next 3 */ + /* v8 ignore next -- @preserve */ if (ttl && typeof ttl !== "number" && typeof ttl !== "string") { throw this.createError(NodeCacheErrors.ETTLTYPE, this.formatKey(key)); } @@ -149,6 +149,7 @@ export class NodeCache extends Hookified { } // Check on max key size + /* v8 ignore next -- @preserve */ if (this.options.maxKeys) { const { maxKeys } = this.options; if (maxKeys > -1 && this.store.size >= maxKeys) { @@ -179,7 +180,7 @@ export class NodeCache extends Hookified { */ public mset(data: Array>): boolean { // Check on keys type - /* c8 ignore next 3 */ + /* v8 ignore next -- @preserve */ if (!Array.isArray(data)) { throw this.createError(NodeCacheErrors.EKEYSTYPE); } @@ -242,6 +243,7 @@ export class NodeCache extends Hookified { for (const key of keys) { const value = this.get(key); + /* v8 ignore next -- @preserve */ if (value) { result[this.formatKey(key)] = value as T; } @@ -477,7 +479,7 @@ export class NodeCache extends Hookified { private createError(errorCode: string, key?: string): Error { let error = errorCode; - /* c8 ignore next 3 */ + /* v8 ignore next -- @preserve */ if (key) { error = error.replace("__key", key); } diff --git a/packages/node-cache/src/store.ts b/packages/node-cache/src/store.ts index 9281fe9e..f7adba7c 100644 --- a/packages/node-cache/src/store.ts +++ b/packages/node-cache/src/store.ts @@ -50,7 +50,7 @@ export class NodeCacheStore extends Hookified { // Hook up the cacheable events this._cache.on("error", (error: Error) => { - /* c8 ignore next 1 */ + /* v8 ignore next -- @preserve */ this.emit("error", error); }); } @@ -133,6 +133,7 @@ export class NodeCacheStore extends Hookified { */ public set maxKeys(maxKeys: number) { this._maxKeys = maxKeys; + /* v8 ignore next -- @preserve */ if (this._maxKeys > 0) { this._cache.stats.enabled = true; }