Skip to content
Merged
2 changes: 0 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
{
"patterns": [
"**/../lib/**",
"**/../src/**",
"mongodb-mock-server"
]
}
Expand Down Expand Up @@ -217,7 +216,6 @@
{
"patterns": [
"**/../lib/**",
"**/../src/**",
"mongodb-mock-server"
]
}
Expand Down
3 changes: 1 addition & 2 deletions test/benchmarks/unitBench/list.bench.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-restricted-modules */
const chalk = require('chalk');
const { List } = require('../../../lib/utils');
const { List } = require('../../../src/utils');
const { createHistogram } = require('perf_hooks');

const iterations = 100;
Expand Down
1 change: 0 additions & 1 deletion test/integration/auth/mongodb_aws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as http from 'http';
import { performance } from 'perf_hooks';
import * as sinon from 'sinon';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { refreshKMSCredentials } from '../../../src/client-side-encryption/providers';
import {
AWSSDKCredentialProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { expect } from 'chai';
import * as fs from 'fs';
import * as path from 'path';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
import { type MongoClient, WriteConcern } from '../../mongodb';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { expect } from 'chai';
import { readFileSync } from 'fs';
import * as path from 'path';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { type CommandStartedEvent, type MongoClient, type MongoClientOptions } from '../../mongodb';
import { type TestConfiguration } from '../../tools/runner/config';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import {
Binary,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from 'chai';
import { env } from 'process';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { Binary } from '../../mongodb';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from 'chai';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { MongoCryptAzureKMSRequestError } from '../../../src/client-side-encryption/errors';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import {
type AzureKMSRequestOptions,
fetchAzureKMSToken
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { expect } from 'chai';
import { env } from 'process';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { MongoCryptAzureKMSRequestError } from '../../../src/client-side-encryption/errors';
import { Binary } from '../../mongodb';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { expect } from 'chai';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { MongoCryptCreateEncryptedCollectionError } from '../../../src/client-side-encryption/errors';
import {
getCSFLEKMSProviders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { readFile } from 'fs/promises';
import { join } from 'path';

import { Decimal128, type Document, Double, Long, type MongoClient } from '../../../src';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { MongoCryptError } from '../../../src/client-side-encryption/errors';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
import { type Binary, Int32, Long } from '../../mongodb';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { AWSSDKCredentialProvider, Binary, MongoClient } from '../../mongodb';
import { getEncryptExtraOptions } from '../../tools/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { expect } from 'chai';
import * as fs from 'fs/promises';
import * as path from 'path';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
import {
Expand Down
1 change: 0 additions & 1 deletion test/integration/client-side-encryption/driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as sinon from 'sinon';
import { setTimeout } from 'timers/promises';
import * as tls from 'tls';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { setTimeout } from 'timers';
import { TLSSocket } from 'tls';
import { promisify } from 'util';

// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
import {
Connection,
Expand Down
3 changes: 0 additions & 3 deletions test/integration/node-specific/client_encryption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import { expect } from 'chai';
import { readFileSync } from 'fs';
import * as sinon from 'sinon';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import {
ClientEncryption,
type DataKey
} from '../../../src/client-side-encryption/client_encryption';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { MongoCryptInvalidArgumentError } from '../../../src/client-side-encryption/errors';
/* eslint-disable @typescript-eslint/no-restricted-imports */
import { StateMachine } from '../../../src/client-side-encryption/state_machine';
import { Binary, type Collection, Int32, Long, type MongoClient, UUID } from '../../mongodb';

Expand Down
1 change: 0 additions & 1 deletion test/mongodb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-restricted-imports */
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as process from 'node:process';
Expand Down
1 change: 0 additions & 1 deletion test/tools/unified-spec-runner/unified-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ConnectionString from 'mongodb-connection-string-url';
import { coerce, gte as semverGte, lte as semverLte } from 'semver';
import { isDeepStrictEqual } from 'util';

/* eslint-disable @typescript-eslint/no-restricted-imports */
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption';
import { getCSFLEKMSProviders } from '../../csfle-kms-providers';
import {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/assorted/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

const { expect } = require('chai');
const mock = require('../../tools/mongodb-mock/index');
const { MongoClient } = require('../../mongodb');
const { isHello } = require('../../mongodb');
const { isHello } = require('../../../src/utils');
const { MongoClient } = require('../../../src/mongo_client');

describe('Client (unit)', function () {
let server, client;
Expand Down
6 changes: 3 additions & 3 deletions test/unit/assorted/collations.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
const mock = require('../../tools/mongodb-mock/index');
const { expect } = require('chai');
const { Long } = require('../../mongodb');
const { isHello } = require('../../mongodb');
const { MongoClient } = require('../../mongodb');
const { Long } = require('../../../src/bson');
const { isHello } = require('../../../src/utils');
const { MongoClient } = require('../../../src/mongo_client');

const testContext = {};
describe('Collation', function () {
Expand Down
7 changes: 4 additions & 3 deletions test/unit/assorted/max_staleness.spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require('path');
const fs = require('fs');
const { executeServerSelectionTest } = require('./server_selection_spec_helper');
const { Server } = require('../../mongodb');
const { Server } = require('../../../src/sdam/server');

const { EJSON } = require('bson');

Expand Down Expand Up @@ -47,10 +47,11 @@ describe('Max Staleness (spec)', function () {
const specTests = collectStalenessTests(maxStalenessDir);
for (const [specTestName, test] of Object.entries(specTests)) {
describe(specTestName, () => {
for (const testData of test)
for (const testData of test) {
it(testData.description, async function () {
return executeServerSelectionTest(testData);
await executeServerSelectionTest(testData);
});
}
});
}
});
14 changes: 6 additions & 8 deletions test/unit/assorted/optional_require.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { expect } from 'chai';
import { existsSync } from 'fs';
import { resolve } from 'path';

import {
AuthContext,
compress,
GSSAPI,
HostAddress,
MongoDBAWS,
MongoMissingDependencyError
} from '../../mongodb';
import { AuthContext } from '../../../src/cmap/auth/auth_provider';
import { GSSAPI } from '../../../src/cmap/auth/gssapi';
import { MongoDBAWS } from '../../../src/cmap/auth/mongodb_aws';
import { compress } from '../../../src/cmap/wire_protocol/compression';
import { MongoMissingDependencyError } from '../../../src/error';
import { HostAddress } from '../../../src/utils';

function moduleExistsSync(moduleName) {
return existsSync(resolve(__dirname, `../../../node_modules/${moduleName}`));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ import { once } from 'events';
import { satisfies } from 'semver';
import * as sinon from 'sinon';

import {
HostAddress,
isHello,
MongoClient,
SrvPoller,
type SrvPollerOptions,
SrvPollingEvent,
type Topology,
type TopologyOptions,
TopologyType
} from '../../mongodb';
import { MongoClient } from '../../../src/mongo_client';
import { TopologyType } from '../../../src/sdam/common';
import { SrvPoller, type SrvPollerOptions, SrvPollingEvent } from '../../../src/sdam/srv_polling';
import type { Topology, TopologyOptions } from '../../../src/sdam/topology';
import { HostAddress, isHello } from '../../../src/utils';
import * as mock from '../../tools/mongodb-mock/index';
import type { MockServer } from '../../tools/mongodb-mock/src/server';
import { processTick, topologyWithPlaceholderClient } from '../../tools/utils';
Expand Down Expand Up @@ -75,10 +69,10 @@ describe('Polling Srv Records for Mongos Discovery', () => {
}

class FakeSrvPoller extends SrvPoller {
start() {
override start() {
return;
}
stop() {
override stop() {
return;
}
trigger(srvRecords) {
Expand Down
11 changes: 4 additions & 7 deletions test/unit/assorted/scram_iterations.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { expect } from 'chai';

import {
isHello,
MongoClient,
MongoCredentials,
MongoNetworkError,
MongoRuntimeError
} from '../../mongodb';
import { MongoCredentials } from '../../../src/cmap/auth/mongo_credentials';
import { MongoNetworkError, MongoRuntimeError } from '../../../src/error';
import { MongoClient } from '../../../src/mongo_client';
import { isHello } from '../../../src/utils';
import * as mock from '../../tools/mongodb-mock/index';

describe('SCRAM Iterations Tests', function () {
Expand Down
41 changes: 21 additions & 20 deletions test/unit/assorted/server_discovery_and_monitoring.spec.test.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
import { EJSON, ObjectId } from 'bson';
import { type Document, EJSON, ObjectId } from 'bson';
import { expect } from 'chai';
import * as fs from 'fs';
import * as path from 'path';
import * as sinon from 'sinon';

import { ConnectionPool } from '../../../src/cmap/connection_pool';
import {
ConnectionPool,
HEARTBEAT_EVENTS,
isRecord,
MongoClient,
SERVER_CLOSED,
SERVER_DESCRIPTION_CHANGED,
SERVER_OPENING,
TOPOLOGY_CLOSED,
TOPOLOGY_DESCRIPTION_CHANGED,
TOPOLOGY_OPENING
} from '../../../src/constants';
import {
MongoCompatibilityError,
MongoError,
MongoNetworkError,
MongoNetworkTimeoutError,
MongoServerError,
ns,
RunCommandOperation,
Server,
SERVER_CLOSED,
SERVER_DESCRIPTION_CHANGED,
SERVER_OPENING,
MongoServerError
} from '../../../src/error';
import { MongoClient } from '../../../src/mongo_client';
import { RunCommandOperation } from '../../../src/operations/run_command';
import {
ServerClosedEvent,
ServerDescription,
ServerDescriptionChangedEvent,
ServerHeartbeatFailedEvent,
ServerHeartbeatStartedEvent,
ServerHeartbeatSucceededEvent,
ServerOpeningEvent,
squashError,
Topology,
TOPOLOGY_CLOSED,
TOPOLOGY_DESCRIPTION_CHANGED,
TOPOLOGY_OPENING,
TopologyClosedEvent,
TopologyDescriptionChangedEvent,
TopologyOpeningEvent,
type TopologyVersion
} from '../../mongodb';
TopologyOpeningEvent
} from '../../../src/sdam/events';
import { Server } from '../../../src/sdam/server';
import { ServerDescription, type TopologyVersion } from '../../../src/sdam/server_description';
import { Topology } from '../../../src/sdam/topology';
import { isRecord, ns, squashError } from '../../../src/utils';
import { ejson } from '../../tools/utils';

const SDAM_EVENT_CLASSES = {
Expand Down
16 changes: 7 additions & 9 deletions test/unit/assorted/server_discovery_and_monitoring.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { ObjectId } from 'bson';
import { expect } from 'chai';
import { type TopologyDescription } from 'mongodb-legacy';
import * as sinon from 'sinon';

import {
MongoClient,
ObjectId,
Server,
ServerDescription,
Topology,
type TopologyDescriptionChangedEvent
} from '../../mongodb';
import { MongoClient } from '../../../src/mongo_client';
import { type TopologyDescriptionChangedEvent } from '../../../src/sdam/events';
import { Server } from '../../../src/sdam/server';
import { ServerDescription } from '../../../src/sdam/server_description';
import { Topology } from '../../../src/sdam/topology';
import { type TopologyDescription } from '../../../src/sdam/topology_description';

describe('Server Discovery and Monitoring', function () {
let serverConnect: sinon.SinonStub;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/assorted/server_selection.spec.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join, resolve } from 'path';
import * as sinon from 'sinon';

import { Server } from '../../mongodb';
import { Server } from '../../../src/sdam/server';
import {
loadLatencyWindowTests,
runServerSelectionLatencyWindowTest
Expand Down
Loading