Skip to content

Instantly share code, notes, and snippets.

@mtimbs
Created March 10, 2020 13:51
Show Gist options
  • Save mtimbs/51d0681066716b19dd89b0cb449c3738 to your computer and use it in GitHub Desktop.
Save mtimbs/51d0681066716b19dd89b0cb449c3738 to your computer and use it in GitHub Desktop.
basic config for jest and dynamodb offline
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
module.exports = async () => {
/* eslint-disable global-require */
const serverless = new (require('serverless'))();
await serverless.init();
const service = await serverless.variables.populateService();
const resources = service.resources.Resources;
const tables = Object.keys(resources)
.map((name) => resources[name])
.filter((r) => r.Type === 'AWS::DynamoDB::Table')
.map((r) => r.Properties);
return {
tables,
port: 8000,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment