title: How to get environment variables defined in serverless.yml in tests
body: <p>I am using the serverless framework for running lambda functions on AWS.</p>
  
  <p>In my <code>serverless.yml</code> there are environment variables that are fetched from SSM.</p>
  
  <p>When I write integration tests for the code, I need the code to have the environment variables and I can't find a good way to do this.</p>
  
  <p>I don't want to duplicate all the variables definitions just for the tests, they are already defined in the serverless.yml. Also, some are secrets and I can't commit them to source conrol, so I would have to also repeat them in the ci environment.</p>
  
  <p>Tried using the <code>serverless-jest-plugin</code> but it is not working and not well maintained.</p>
  
  <p>Ideas I had for solutions:</p>
  
  <ol>
  <li>Make the tests exec <code>sls invoke</code> - this will work but would mean that the code cannot be debugged, I won't know the test coverage, and it will be slow.</li>
  <li>Parse the <code>serverless.yml</code> myself and export the env variables - possible but rewriting the logic of pulling the SSM variables just for tests seems wrong.</li>
  </ol>
  
  <p>Any ideas?</p>