99x / dynamodb-localhost

Dynamodb localhost runner for development and testing
MIT License
35 stars 92 forks source link

Allow to run in the background #21

Open mathieudevos opened 6 years ago

mathieudevos commented 6 years ago

As simple as this command is, this is truly required on any setup that requires testing.

Ideally in my mocha tests, I would write in the global_config.js:

/* eslint-disable */
const dynamodbLocal = require('dynamodb-localhost');

// setup the database
before(async function () {
  await dynamodbLocal.install();
  await dynamodbLocal.start({ port: 8000 });
});

// teardown
after(async function() {
  await dynamodbLocal.stop();
});

// run before each test
beforeEach(() => {});

// run after each test
afterEach(() => {});

Obviously with other test files next to it, who just make a dynamodb connection to the local test database. This setup, the serverless plugin, or the original dynamodb-local, none of them support the option to run this in the background, as such, these are all useless when attempting to run a CI/CD job on. I can't tell a pipeline to "press ctrl-c" when you're done.

ThorstenBux commented 6 years ago

https://www.npmjs.com/package/dynamodb-local allows for running detached