File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ module.exports = async function () {
4141 DynamoDbLocal . configureInstaller ( installerConfig ) ;
4242 }
4343
44- global . __DYNAMODB__ = await DynamoDbLocal . launch ( port , null , options ) ;
44+ if ( ! global . __DYNAMODB__ ) {
45+ global . __DYNAMODB__ = await DynamoDbLocal . launch ( port , null , options ) ;
46+ }
4547 }
4648
4749 await createTables ( dynamoDB , newTables ) ;
Original file line number Diff line number Diff line change 11const DynamoDbLocal = require ( 'dynamodb-local' ) ;
22const debug = require ( 'debug' ) ( 'jest-dynamodb' ) ;
33
4- module . exports = async function ( ) {
4+ module . exports = async function ( jestArgs ) {
55 // eslint-disable-next-line no-console
66 debug ( 'Teardown DynamoDB' ) ;
77
88 if ( global . __DYNAMODB__ ) {
9- await DynamoDbLocal . stopChild ( global . __DYNAMODB__ ) ;
9+ const watching = jestArgs . watch || jestArgs . watchAll ;
10+ if ( ! watching ) {
11+ await DynamoDbLocal . stopChild ( global . __DYNAMODB__ ) ;
12+ }
1013 } else {
1114 const dynamoDB = global . __DYNAMODB_CLIENT__ ;
1215 const { TableNames : tableNames } = await dynamoDB . listTables ( ) . promise ( ) ;
You can’t perform that action at this time.
0 commit comments