Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Auto-close dynalite when tape is finished #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var dynalite = require('dynalite')({
var listening = false;

module.exports = ddbtest;
module.exports.dynalite = dynalite;
module.exports.fixedName = function(test, tableName, tableDef) {
var dynamo = ddbtest(test, tableName, tableDef);
dynamo.tableName = dynamo.tableDef.TableName = tableName;
Expand All @@ -33,7 +34,7 @@ function ddbtest(test, projectName, tableDef, region) {
}, {});
}

var dynamodb = {};
var dynamodb = {dynalite: dynalite};

dynamodb.tableName = tableDef.TableName = [
'test',
Expand Down Expand Up @@ -71,6 +72,7 @@ function ddbtest(test, projectName, tableDef, region) {
dynalite.listen(4567, function(err) {
if (err) throw err;
listening = true;
test.onFinish(function(){ dynalite.close(); });
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause any problems if dynalite is already closed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, not in my tests.

dynamodb.dyno.createTable(tableDef, done);
});
}
Expand Down