From fbec5c0eba6de615596dc6710bea1e99c08fbb2e Mon Sep 17 00:00:00 2001 From: Ciro Spaciari MacBook Date: Fri, 16 Jan 2026 17:39:28 -0800 Subject: [PATCH] fix(s3): use optional chaining in metadata tests to avoid eval error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When minioCredentials is undefined (no Docker), the describe callback is still evaluated even though the tests are skipped. Using optional chaining with fallbacks prevents the TypeError during evaluation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- test/js/bun/s3/s3.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/js/bun/s3/s3.test.ts b/test/js/bun/s3/s3.test.ts index 123cf51aef..ad34a389ce 100644 --- a/test/js/bun/s3/s3.test.ts +++ b/test/js/bun/s3/s3.test.ts @@ -1677,11 +1677,13 @@ describe.skipIf(!minioCredentials)("Archive with S3", () => { // Metadata tests - test with MinIO only since it properly supports x-amz-meta-* headers describe.skipIf(!minioCredentials?.endpoint)("S3 Metadata (x-amz-meta-*)", () => { + // Use optional chaining with fallbacks to avoid evaluation errors when minioCredentials is undefined + // (the describe is skipped in that case, but the callback is still evaluated) const credentials: S3Options = { - accessKeyId: minioCredentials!.accessKeyId, - secretAccessKey: minioCredentials!.secretAccessKey, - endpoint: minioCredentials!.endpoint, - bucket: minioCredentials!.bucket, + accessKeyId: minioCredentials?.accessKeyId ?? "", + secretAccessKey: minioCredentials?.secretAccessKey ?? "", + endpoint: minioCredentials?.endpoint ?? "", + bucket: minioCredentials?.bucket ?? "", }; it("should upload and retrieve metadata via S3File.write() and stat()", async () => {