aws-sdk-mock
aws-sdk-mock copied to clipboard
Broken by [email protected]
At least some of the service objects in aws-sdk v2.6.x are now getter/setter-only properties. This hits an upstream bug: https://github.com/sinonjs/sinon/issues/1018.
var AWS = require('aws-sdk'); // @2.6.1
var MockAWS = require('aws-sdk-mock');
MockAWS.mock('ECS', 'listTasks', function() {});
/Users/r/tmp/nope/node_modules/aws-sdk-mock/node_modules/sinon/lib/sinon/util/core.js:91
throw error;
^
TypeError: Attempted to wrap undefined property ECS as function
at checkWrappedMethod (/Users/r/tmp/nope/node_modules/aws-sdk-mock/node_modules/sinon/lib/sinon/util/core.js:78:29)
at Object.wrapMethod (/Users/r/tmp/nope/node_modules/aws-sdk-mock/node_modules/sinon/lib/sinon/util/core.js:121:21)
at Object.stub (/Users/r/tmp/nope/node_modules/aws-sdk-mock/node_modules/sinon/lib/sinon/stub.js:67:26)
at mockService (/Users/r/tmp/nope/node_modules/aws-sdk-mock/index.js:67:27)
at Object.AWS.mock (/Users/r/tmp/nope/node_modules/aws-sdk-mock/index.js:43:5)
at Object.<anonymous> (/Users/r/tmp/nope/test.js:4:9)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
@rclark thanks very much for informing us ... please let us know if you make any progress with your investigation on in the Sinon issue.
+1 just saw this break our specs today.
Pull Requests v. much welcomed!
Even though the sinon bug shouldn't be too hard to solve, it'll be backed up in a sinon v2 release. I wonder if aws-sdk-mock needs to hack around the bug to get working on the updated aws-sdk sooner?
@nelsonic generally, I've found that I can't do this with sinon anymore:
var stub = sinon.stub(AWS, 'ECS');
... but I can do this:
var stub = sinon.stub();
var ECS = AWS.ECS;
AWS.ECS = stub;
Would an approach like this work in aws-sdk-mock? If that sounds like a direction to pursue I can try and PR.
+1 it broke my specs today.
We locked our aws-sdk @ version 2.5.6 in package.json to get things working again.
Can you give version 2.6.4 of the SDK a try? We updated the SDK to lazy-load service client models instead of the entire service client class. I ran one of the examples in this project's README and it succeeded with the latest version of the SDK.
@chrisradek That worked!
any idea when you can support latest version of [email protected]? I don't want to go back to previous version if we didn't have to. thanks!