8 Commits

Author SHA1 Message Date
eabda34aca 2.0.6 2022-06-09 00:01:30 +02:00
0e41748da5 fix(core): update 2022-06-09 00:01:29 +02:00
f4586d529d 2.0.5 2022-06-06 17:38:35 +02:00
c09eaf613d fix(core): update 2022-06-06 17:38:35 +02:00
d5ff5b0ed8 2.0.4 2022-06-06 16:51:41 +02:00
1783d72395 fix(core): update 2022-06-06 16:51:41 +02:00
a01755fb9e 2.0.3 2022-06-03 17:31:05 +02:00
3ebf34ee9d fix(core): update 2022-06-03 17:31:04 +02:00
6 changed files with 752 additions and 883 deletions

1599
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartmongo",
"version": "2.0.2",
"version": "2.0.6",
"private": false,
"description": "create a local mongodb for testing",
"main": "dist_ts/index.js",
@@ -10,19 +10,21 @@
"license": "MIT",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
"build": "(tsbuild --web --allowimplicitany)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.61",
"@gitzone/tsbundle": "^2.0.3",
"@gitzone/tsbuild": "^2.1.63",
"@gitzone/tsbundle": "^2.0.5",
"@gitzone/tstest": "^1.0.71",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.34"
"@types/node": "^17.0.39"
},
"dependencies": {
"@pushrocks/smartdata": "^4.0.27",
"@pushrocks/mongodump": "^1.0.7",
"@pushrocks/smartdata": "^5.0.3",
"@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^3.1.7",
"mongodb-memory-server": "^8.5.2"
"mongodb-memory-server": "^8.6.0"
},
"browserslist": [
"last 1 chrome versions"

View File

@@ -8,7 +8,7 @@ tap.test('should create a mongo instance', async () => {
});
tap.test('should stop the instance', async () => {
await smartmongoInstance.stop();
await smartmongoInstance.stopAndDumpToDir('.nogit/');
})
tap.start();

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartmongo',
version: '2.0.2',
version: '2.0.6',
description: 'create a local mongodb for testing'
}

View File

@@ -33,11 +33,21 @@ export class SmartMongo {
public async getMongoDescriptor(): Promise<plugins.smartdata.IMongoDescriptor> {
await this.readyPromise;
return {
mongoDbName: `smartmongo_testdatabase`,
mongoDbUrl: this.mongoReplicaSet.getUri(),
};
}
public async stop() {
await this.mongoReplicaSet.stop(true);
await this.mongoReplicaSet.stop();
await this.mongoReplicaSet.cleanup();
}
public async stopAndDumpToDir(dirArg: string, nameFunctionArg?: (doc: any) => string, emptyDirArg = true) {
const mongodumpInstance = new plugins.mongodump.MongoDump();
const mongodumpTarget = await mongodumpInstance.addMongoTargetByMongoDescriptor(await this.getMongoDescriptor());
await mongodumpTarget.dumpAllCollectionsToDir(dirArg, nameFunctionArg, emptyDirArg);
await mongodumpInstance.stop();
await this.stop();
}
}

View File

@@ -1,9 +1,13 @@
// @pushrocks scope
import * as mongodump from '@pushrocks/mongodump';
import * as smartdata from '@pushrocks/smartdata';
import * as smartpath from '@pushrocks/smartpath';
import * as smartpromise from '@pushrocks/smartpromise';
export {
mongodump,
smartdata,
smartpath,
smartpromise,
}