How to get environment variables defined in serverless.yml in tests

The solution we ended up using is a serverless plugin called serverless-export-env.

After adding this plugin you can run serverless export-env to export all the resolved environment variables to an .env file. This resolves ssm parameters correctly and made integration testing much simpler for us.

BTW, to get the environment variables set from the .env file use the the dotenv npm package.

Credit to grishezz for finding the solution