Created
March 10, 2020 13:51
-
-
Save mtimbs/51d0681066716b19dd89b0cb449c3738 to your computer and use it in GitHub Desktop.
basic config for jest and dynamodb offline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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