File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,13 @@ module.exports = async function () {
3838 global . __DYNAMODB_CLIENT__ = dynamoDB ;
3939
4040 try {
41- const { TableNames : tableNames } = await Promise . race ( [
42- dynamoDB . listTables ( { } ) ,
43- waitForLocalhost ( port )
44- ] ) ;
41+ const promises = [ dynamoDB . listTables ( { } ) ] ;
42+
43+ if ( ! global . __DYNAMODB__ ) {
44+ promises . push ( waitForLocalhost ( port ) ) ;
45+ }
46+
47+ const { TableNames : tableNames } = await Promise . race ( promises ) ;
4548 await deleteTables ( dynamoDB , tableNames ) ; // cleanup leftovers
4649 } catch ( err ) {
4750 // eslint-disable-next-line no-console
@@ -70,7 +73,5 @@ async function createTables(dynamoDB, tables) {
7073}
7174
7275async function deleteTables ( dynamoDB , tableNames ) {
73- return Promise . all (
74- tableNames . map ( tableName => dynamoDB . deleteTable ( { TableName : tableName } ) . promise ( ) )
75- ) ;
76+ return Promise . all ( tableNames . map ( tableName => dynamoDB . deleteTable ( { TableName : tableName } ) ) ) ;
7677}
You can’t perform that action at this time.
0 commit comments