cypress-mongodb
Advanced tools
Comparing version 5.1.4 to 5.2.1
@@ -12,2 +12,3 @@ "use strict"; | ||
collection: (options === null || options === void 0 ? void 0 : options.collection) || Cypress.env('mongodb').collection, | ||
upsert: options === null || options === void 0 ? void 0 : options.upsert, | ||
}, | ||
@@ -43,2 +44,3 @@ filter: filter, | ||
collection: (options === null || options === void 0 ? void 0 : options.collection) || Cypress.env('mongodb').collection, | ||
upsert: options === null || options === void 0 ? void 0 : options.upsert, | ||
}, | ||
@@ -45,0 +47,0 @@ filter: filter, |
@@ -37,4 +37,5 @@ /// <reference types="node" /> | ||
failSilently?: boolean; | ||
upsert?: boolean; | ||
} | ||
export declare function configurePlugin(on: Cypress.PluginEvents): void; | ||
export declare function addCommands(): void; |
/// <reference types="node" /> | ||
export declare function updateOne(args: any): Promise<Buffer | null>; | ||
export declare function updateMany(args: any): Promise<Buffer>; | ||
export declare function updateMany(args: any): Promise<Buffer | null>; |
@@ -56,3 +56,3 @@ "use strict"; | ||
collection = database.collection(args.options.collection); | ||
return [4, collection.updateOne(args.filter, args.pipeline)]; | ||
return [4, collection.updateOne(args.filter, args.pipeline, args.options)]; | ||
case 1: | ||
@@ -63,5 +63,3 @@ result = _a.sent(); | ||
_a.sent(); | ||
if (result !== null) | ||
return [2, (0, bson_1.serialize)(result)]; | ||
return [2, null]; | ||
return [2, result ? (0, bson_1.serialize)(result) : null]; | ||
case 3: | ||
@@ -88,22 +86,23 @@ err_1 = _a.sent(); | ||
return [2, mongodb_1.MongoClient.connect(args.uri).then(function (client) { return __awaiter(_this, void 0, void 0, function () { | ||
var err_2; | ||
var database, collection, result, err_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 1, , 3]); | ||
return [2, client | ||
.db(args.options.database) | ||
.collection(args.options.collection) | ||
.updateMany(args.filter, args.pipeline) | ||
.then(function (result) { | ||
client.close(); | ||
return (0, bson_1.serialize)(result); | ||
})]; | ||
_a.trys.push([0, 3, , 5]); | ||
database = client.db(args.options.database); | ||
collection = database.collection(args.options.collection); | ||
return [4, collection.updateMany(args.filter, args.pipeline, args.options)]; | ||
case 1: | ||
err_2 = _a.sent(); | ||
result = _a.sent(); | ||
return [4, client.close()]; | ||
case 2: | ||
_a.sent(); | ||
return [2, result ? (0, bson_1.serialize)(result) : null]; | ||
case 3: | ||
err_2 = _a.sent(); | ||
return [4, client.close()]; | ||
case 4: | ||
_a.sent(); | ||
throw err_2; | ||
case 3: return [2]; | ||
case 5: return [2]; | ||
} | ||
@@ -110,0 +109,0 @@ }); |
{ | ||
"name": "cypress-mongodb", | ||
"version": "5.1.4", | ||
"version": "5.2.1", | ||
"description": "Cypress MongoDB plugin", | ||
@@ -35,3 +35,3 @@ "main": "./dist/index.js", | ||
"@types/node": "^18.11.9", | ||
"cypress": "^11.2.0", | ||
"cypress": "12.7.0", | ||
"prettier": "^2.8.0", | ||
@@ -38,0 +38,0 @@ "typescript": "^4.9.3" |
@@ -13,3 +13,3 @@ # Introduction | ||
4.4, 5.0 | ||
4.4, 5.0, 6.0 | ||
@@ -16,0 +16,0 @@ # Usage |
57677
1076