diff --git a/src/index.ts b/src/index.ts index 19b2359379..900baf8dd0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -364,7 +364,12 @@ export type { RunCursorCommandOptions } from './cursor/run_command_cursor'; export type { DbOptions, DbPrivate } from './db'; export type { Encrypter, EncrypterOptions } from './encrypter'; export type { AnyError, ErrorDescription, MongoNetworkErrorOptions } from './error'; -export type { Explain, ExplainOptions, ExplainVerbosityLike } from './explain'; +export type { + Explain, + ExplainCommandOptions, + ExplainOptions, + ExplainVerbosityLike +} from './explain'; export type { GridFSBucketReadStreamOptions, GridFSBucketReadStreamOptionsWithRevision, diff --git a/test/integration/shared.js b/test/integration/shared.js index 4a276edef9..6bbbff6beb 100644 --- a/test/integration/shared.js +++ b/test/integration/shared.js @@ -63,15 +63,14 @@ function dropCollection(dbObj, collectionName, options = {}) { * @returns a function that collects the specified comment events */ function filterForCommands(commands, bag) { - const predicate = - typeof commands === 'function' - ? commands - : command => { - const specifiedCommandNames = [commands].flat(); - return specifiedCommandNames.includes(command.commandName); - }; + if (typeof commands === 'function') { + return function (event) { + if (commands(event.commandName)) bag.push(event); + }; + } + commands = Array.isArray(commands) ? commands : [commands]; return function (event) { - if (predicate(event.commandName)) bag.push(event); + if (commands.indexOf(event.commandName) !== -1) bag.push(event); }; }