Sinon and AWS Lambda

46 views
Skip to first unread message

Chad W Pry

unread,
May 21, 2017, 1:46:38 PM5/21/17
to Sinon.JS
Hi everyone,

Are there best practices when using Sinon to test AWS Lambda? While I understand the practice of stubbing, mocking, and spying, I have not found a best approach with Lambda as everything is a private reference inside the module (aka no injecting dependencies). There are a couple options, listed below, I found that attempt to address the issue by handling proxying or mocking at the require level. It does not feel quite right, a little smelly, as I read through the details.

Proxyquire

Mock Require

Given my lack of familiarity with Sinon, I would love any input, direction, or examples!

Cheers,
Chad
Reply all
Reply to author
Forward
0 new messages