diff --git a/setup.js b/setup.js index c592eca..0a48f7e 100644 --- a/setup.js +++ b/setup.js @@ -12,13 +12,16 @@ const DEFAULT_OPTIONS = ['-sharedDb']; module.exports = async function() { const config = require(resolve(cwd(), 'jest-dynamodb-config.js')); - const {tables, port: port = DEFAULT_PORT, options: options = DEFAULT_OPTIONS} = + const {tables, port: port = DEFAULT_PORT, options: options = DEFAULT_OPTIONS, clientConfig} = typeof config === 'function' ? await config() : config; + const dynamoDB = new DynamoDB({ - endpoint: 'localhost:' + port, + endpoint: `localhost:${port}`, sslEnabled: false, - region: 'local-env' + region: 'local-env', + ...clientConfig }); + global.__DYNAMODB__ = await DynamoDbLocal.launch(port, null, options); await createTables(dynamoDB, tables);