dynamodb-localhost
dynamodb-localhost copied to clipboard
Allow to run in the background
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.
https://www.npmjs.com/package/dynamodb-local allows for running detached