Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dzy321/docker-mysql-driver

docker mysql driver for unit test
https://github.com/dzy321/docker-mysql-driver

mysql node unit-testing

Last synced: about 16 hours ago
JSON representation

docker mysql driver for unit test

Awesome Lists containing this project

README

        

docker-mysql-driver
=================

[![](https://img.shields.io/npm/v/docker-mysql-driver.svg?style=flat)](https://www.npmjs.com/package/docker-mysql-driver)

## Feature

- auto run mysql in docker
- reinitialize the environment at each start

## Usage

- docker pull mysql image (default: mysql:5.6)

### Getting start

```js
const dmd = require('docker-mysql-driver')

const mysqlServer = await dmd.start(options)

console.log(
mysqlServer.port, // server port
mysqlServer.rootPwd, // root password
mysqlServer.database, // database name
)

mysqlServer.stop()
```

### Default Options

```js
{
image: "mysql:5.6", // mysql docker image
port: 0, // host port, 0 for random
rootPwd: "123456", // root password
reuse: true, // reuse container, container will not be delete if enabled
name: 'mysql_test', // container name
database: 'test_db', // database name
dockerConfig: undefined, // you can see: https://github.com/apocas/dockerode
}
```