cypress-mongodb
Version:
Cypress MongoDB plugin
106 lines • 4.27 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.configurePlugin = configurePlugin;
const aggregate_util = __importStar(require("./utils/aggregation"));
const collection_util = __importStar(require("./utils/collection"));
const insert_util = __importStar(require("./utils/insert"));
const delete_util = __importStar(require("./utils/delete"));
const find_util = __importStar(require("./utils/find"));
const update_util = __importStar(require("./utils/update"));
const command_util = __importStar(require("./utils/command"));
const webpack_batteries_included_preprocessor_1 = __importDefault(require("@cypress/webpack-batteries-included-preprocessor"));
function getWebpackOptions() {
const options = webpack_batteries_included_preprocessor_1.default.getFullWebpackOptions();
options.devtool = 'inline-source-map';
options.resolve.fallback.crypto = require.resolve('crypto-browserify');
options.resolve.fallback.util = require.resolve('util');
options.resolve.fallback.zlib = require.resolve('browserify-zlib');
return options;
}
function configurePlugin(on) {
on('file:preprocessor', (0, webpack_batteries_included_preprocessor_1.default)({
typescript: 'typescript',
webpackOptions: getWebpackOptions(),
}));
on('task', {
async aggregate(args) {
return await aggregate_util.aggregate(args);
},
async createCollection(args) {
return await collection_util.createCollection(args);
},
async dropCollection(args) {
return await collection_util.dropCollection(args);
},
async insertOne(args) {
return await insert_util.insertOne(args);
},
async insertMany(args) {
return await insert_util.insertMany(args);
},
async deleteOne(args) {
return await delete_util.deleteOne(args);
},
async deleteMany(args) {
return await delete_util.deleteMany(args);
},
async findOne(args) {
return await find_util.findOne(args);
},
async findOneAndUpdate(args) {
return await find_util.findOneAndUpdate(args);
},
async findOneAndDelete(args) {
return await find_util.findOneAndDelete(args);
},
async findMany(args) {
return await find_util.findMany(args);
},
async updateOne(args) {
return await update_util.updateOne(args);
},
async updateMany(args) {
return await update_util.updateMany(args);
},
async runCommand(args) {
return await command_util.runCommand(args);
},
});
}
//# sourceMappingURL=index.js.map