diff --git a/jest-dynamodb-config.js b/jest-dynamodb-config.js index 32b9b5d..3ab2f0a 100644 --- a/jest-dynamodb-config.js +++ b/jest-dynamodb-config.js @@ -7,5 +7,6 @@ module.exports = { ProvisionedThroughput: {ReadCapacityUnits: 1, WriteCapacityUnits: 1} } ], - port: 8000 + port: 8000, + options: ['-sharedDb'] }; diff --git a/setup.js b/setup.js index 392f421..c592eca 100644 --- a/setup.js +++ b/setup.js @@ -8,17 +8,18 @@ process.env.AWS_ACCESS_KEY_ID = 'access-key'; process.env.AWS_SECRET_ACCESS_KEY = 'secret-key'; const DEFAULT_PORT = 8000; +const DEFAULT_OPTIONS = ['-sharedDb']; module.exports = async function() { const config = require(resolve(cwd(), 'jest-dynamodb-config.js')); - const {tables, port: port = DEFAULT_PORT} = + const {tables, port: port = DEFAULT_PORT, options: options = DEFAULT_OPTIONS} = typeof config === 'function' ? await config() : config; const dynamoDB = new DynamoDB({ endpoint: 'localhost:' + port, sslEnabled: false, region: 'local-env' }); - global.__DYNAMODB__ = await DynamoDbLocal.launch(port, null, ['-sharedDb']); + global.__DYNAMODB__ = await DynamoDbLocal.launch(port, null, options); await createTables(dynamoDB, tables); };