Skip to content

fix: prevent response stubbing conflicts with testing libraries - #3502

Merged
jterapin merged 1 commit into
version-3from
issue-3501-mocha-config
Nov 20, 2026
Merged

jterapin merged 1 commit into
version-3from
issue-3501-mocha-config

Conversation

@jterapin

Copy link
Copy Markdown
Contributor

Description

aws-sdk-core 3.270.0 changed client configuration objects to resolve settings through method_missing. When Mocha is loaded, its inherited Object#stubs method shadows the SDK configuration setting with the same name.

Customer impact

Tests that combine Mocha with an AWS client configured with stub_responses: true fail with an ArgumentError on stubbed requests. This change restores response stubbing without requiring customers to change their tests.

Fix

Read the SDK's internal response-stub storage by key so inherited methods cannot intercept it. Add regression coverage for a conflicting Object#stubs method.

Fixes #3501.

Testing

  • Focused aws-sdk-core specs: 19 examples, 0 failures
  • Full aws-sdk-core suite: 2,526 examples, 0 failures, 36 pending
  • Mocha 3.1.0 with Minitest and an S3 stubbed response: passed

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

🤖 This PR description was drafted with AI assistance and reviewed by @jterapin. ✨

@jterapin
jterapin requested review from a team as code owners November 20, 2026 00:57
@jterapin
jterapin merged commit 479cac8 into version-3 Nov 20, 2026
35 of 36 checks passed
@jterapin
jterapin deleted the issue-3501-mocha-config branch November 20, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stub_responses clients fail under Mocha since 3.270.0: Object#stubs shadows the stubs config option

3 participants