mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
fix(s3): use optional chaining in metadata tests to avoid eval error
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user