mongo-unit
Advanced tools
Comparing version 1.2.0 to 1.3.0
13
index.js
'use strict'; | ||
//process.env.DEBUG= '*' | ||
const Debug = require('debug') | ||
@@ -18,2 +17,3 @@ const portfinder = require('portfinder') | ||
var mongodHelper | ||
var dbUrl | ||
@@ -24,3 +24,3 @@ | ||
opts.port = port | ||
const mongodHelper = new MongodHelper(['--port', port, '--dbpath', opts.dbpath,'--storageEngine', 'ephemeralForTest']); | ||
mongodHelper = new MongodHelper(['--port', port, '--dbpath', opts.dbpath,'--storageEngine', 'ephemeralForTest']); | ||
return mongodHelper.run() | ||
@@ -50,2 +50,10 @@ .then(()=>{ | ||
function delay(time){ | ||
return new Promise(resolve=>setTimeout(resolve, time)) | ||
} | ||
function stop(){ | ||
mongodHelper && mongodHelper.mongoBin.childProcess.kill() | ||
return delay(100) //this is small delay to make sure kill signal is sent | ||
} | ||
function getUrl() { | ||
@@ -154,2 +162,3 @@ if(dbUrl){ | ||
start, | ||
stop, | ||
getUrl, | ||
@@ -156,0 +165,0 @@ load, |
{ | ||
"name": "mongo-unit", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "mongo db for unit tests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# mongo-unit | ||
[![build status](https://travis-ci.org/mikhail-angelov/mongo-unit.svg?branch=master)](https://travis-ci.org/mikhail-angelov/mongo-unit) | ||
[![CircleCI](https://circleci.com/gh/mikhail-angelov/mongo-unit.svg?style=svg)](https://circleci.com/gh/mikhail-angelov/mongo-unit) | ||
[![NPM](https://nodei.co/npm/mongo-unit.png)](https://nodei.co/npm/mongo-unit) | ||
@@ -30,3 +31,6 @@ | ||
`opts.verbose` - enable debug informaton for mongodb-prebuilt, default: `false` | ||
### `stop()` | ||
It stops mongod process | ||
### `getUrl()` | ||
@@ -57,2 +61,8 @@ Syncronius API returns URL to connect to test db, if test DB is not started it thows an Exception | ||
### `initDb(url, data)` | ||
helper function, load db data into mongo (url) | ||
### `dropDb(url)` | ||
helper function, clear all db data from mongo (url) | ||
### Basic Usage | ||
@@ -59,0 +69,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 11 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
429630
79
149
148
66