Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
{
"name": "setInterval",
"message": "Use `import { setInterval } from 'timers';` instead"
},
{
"name": "process",
"message": "Use `import * as process from 'node:process';` instead"
}
],
"prettier/prettier": "error",
Expand Down Expand Up @@ -318,4 +322,4 @@
}
}
]
}
}
2 changes: 2 additions & 0 deletions src/client-side-encryption/state_machine.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as fs from 'fs/promises';
import { type MongoCryptContext, type MongoCryptKMSRequest } from 'mongodb-client-encryption';
import * as net from 'net';
Expand Down
2 changes: 2 additions & 0 deletions src/cmap/auth/aws_temporary_credentials.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { type AWSCredentials, getAwsCredentialProvider } from '../../deps';
import { MongoAWSError } from '../../error';

Expand Down
2 changes: 2 additions & 0 deletions src/cmap/auth/gssapi.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as dns from 'dns';

import { getKerberos, type Kerberos, type KerberosClient } from '../../deps';
Expand Down
2 changes: 2 additions & 0 deletions src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { readFile } from 'fs/promises';

import type { OIDCCallbackFunction, OIDCResponse } from '../mongodb_oidc';
Expand Down
2 changes: 2 additions & 0 deletions src/cmap/auth/mongodb_oidc/token_machine_workflow.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as fs from 'fs';

import { MongoAWSError } from '../../../error';
Expand Down
2 changes: 2 additions & 0 deletions src/cmap/connection_pool.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { clearTimeout, setTimeout } from 'timers';

import type { ObjectId } from '../bson';
Expand Down
2 changes: 2 additions & 0 deletions src/connection_string.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as dns from 'dns';
import ConnectionString from 'mongodb-connection-string-url';
import { URLSearchParams } from 'url';
Expand Down
2 changes: 2 additions & 0 deletions src/gridfs/upload.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { Writable } from 'stream';

import { type Document, ObjectId } from '../bson';
Expand Down
2 changes: 2 additions & 0 deletions src/mongo_logger.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { inspect } from 'util';

import {
Expand Down
2 changes: 2 additions & 0 deletions src/sdam/monitor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { clearTimeout, setTimeout } from 'timers';

import { type Document, Long } from '../bson';
Expand Down
2 changes: 2 additions & 0 deletions src/sdam/server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import type { Document } from '../bson';
import { type AutoEncrypter } from '../client-side-encryption/auto_encrypter';
import { type CommandOptions, Connection } from '../cmap/connection';
Expand Down
2 changes: 2 additions & 0 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import type { BSONSerializeOptions, Document } from '../bson';
import type { MongoCredentials } from '../cmap/auth/mongo_credentials';
import type { ConnectionEvents } from '../cmap/connection';
Expand Down
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as crypto from 'crypto';
import type { SrvRecord } from 'dns';
import { type EventEmitter } from 'events';
Expand Down
2 changes: 2 additions & 0 deletions test/atlas/drivers_atlas_testing.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { runUnifiedSuite } from '../tools/unified-spec-runner/runner';

describe('Node Driver Atlas Testing', function () {
Expand Down
5 changes: 3 additions & 2 deletions test/benchmarks/driver_bench/src/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import events from 'node:events';
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
import util from 'node:util';

import {
Expand Down Expand Up @@ -113,8 +114,8 @@ for (const [suite, benchmarks] of Object.entries(tests)) {

const metricInfoFilterByName =
(testName: string) =>
({ info: { test_name } }: MetricInfo) =>
test_name === testName;
({ info: { test_name } }: MetricInfo) =>
test_name === testName;

const isMBsMetric = ({ name }: Metric) => name === 'megabytes_per_second';

Expand Down
1 change: 1 addition & 0 deletions test/benchmarks/unitBench/list.bench.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const chalk = require('chalk');
const { List } = require('../../../src/utils');
const { createHistogram } = require('perf_hooks');
import * as process from 'node:process';

const iterations = 100;
const defaultItemsSize = 100000;
Expand Down
2 changes: 2 additions & 0 deletions test/csfle-kms-providers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { type KMSProviders } from './../src';

const csfleKMSProviders = {
Expand Down
2 changes: 2 additions & 0 deletions test/explicit-resource-management/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { AbstractCursor, ChangeStream, ClientSession, GridFSBucket, MongoClient } from 'mongodb';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/auth/auth.prose.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import * as sinon from 'sinon';

Expand Down
1 change: 1 addition & 0 deletions test/integration/auth/mongodb_oidc.prose.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { readFile } from 'node:fs/promises';
import * as path from 'node:path';
import * as process from 'node:process';

import { expect } from 'chai';
import * as sinon from 'sinon';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/auth/mongodb_oidc_azure.prose.05.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

import { type Collection, MongoClient, type MongoClientOptions } from '../../../src';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

import { type Collection, MongoClient, type MongoClientOptions } from '../../../src';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

import { type Collection, MongoClient } from '../../../src';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// The corpus test exhaustively enumerates all ways to encrypt all BSON value types. Note, the test data includes BSON binary subtype 4 (or standard UUID), which MUST be decoded and encoded as subtype 4. Run the test as follows.

import * as process from 'node:process';

import { EJSON } from 'bson';
import { expect } from 'chai';
import * as fs from 'fs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { satisfies } from 'semver';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as BSON from 'bson';
import { expect } from 'chai';
import { readFileSync } from 'fs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

import { Binary, MongoClient } from '../../../src';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { BSON, EJSON } from 'bson';
import { expect } from 'chai';
import * as fs from 'fs/promises';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/client-side-encryption/driver.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { UUID } from 'bson';
import { expect } from 'chai';
import * as crypto from 'crypto';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type EventEmitter, once } from 'node:events';
import * as process from 'node:process';
import { setTimeout } from 'node:timers';

import { expect } from 'chai';
Expand Down
3 changes: 2 additions & 1 deletion test/integration/crud/insert.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as process from 'node:process';
import * as Script from 'node:vm';

import { expect } from 'chai';
Expand Down Expand Up @@ -745,7 +746,7 @@ describe('crud - insert', function () {
try {
db.collection(k.toString());
test.fail(false);
} catch (ignore) {} // eslint-disable-line
} catch (ignore) { } // eslint-disable-line
});

it('should correctly honor `promoteLong:false` native BSON', async function () {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/crud/unicode.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { satisfies } from 'semver';

Expand Down
2 changes: 2 additions & 0 deletions test/integration/load-balancers/load_balancers.spec.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import * as path from 'path';

import { loadSpecTests } from '../../spec/index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import * as sinon from 'sinon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import * as net from 'net';
import * as sinon from 'sinon';
Expand Down
1 change: 1 addition & 0 deletions test/integration/node-specific/client_close.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as events from 'node:events';
import * as process from 'node:process';

import { expect } from 'chai';

Expand Down
2 changes: 2 additions & 0 deletions test/integration/node-specific/compression.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

describe('compression configuration tests', function () {
Expand Down
2 changes: 2 additions & 0 deletions test/integration/node-specific/crypt_shared_lib.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { spawnSync } from 'child_process';
import { dirname } from 'path';
Expand Down
1 change: 1 addition & 0 deletions test/integration/node-specific/cursor_stream.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { strictEqual } from 'node:assert';
import { on, once } from 'node:events';
import * as process from 'node:process';

import { expect } from 'chai';

Expand Down
1 change: 1 addition & 0 deletions test/integration/node-specific/examples/aws_handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// begin lambda connection
const { MongoClient } = require('mongodb');
const process = require('node:process');

// Get the URI for the cluster and use AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
// from the environment, then set the appropriate auth options. Note that MongoClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint no-unused-vars: 0 */
/* eslint no-unused-vars: 0 no-restricted-globals: 0 */

'use strict';

const { setTimeout } = require('timers');
Expand Down
1 change: 1 addition & 0 deletions test/integration/node-specific/examples/handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// begin lambda connection
const { MongoClient } = require('mongodb');
const process = require('node:process');

// MongoClient now auto-connects so no need to store the connect()
// promise anywhere and reference it.
Expand Down
2 changes: 2 additions & 0 deletions test/integration/node-specific/mongo_client.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { once } from 'events';
import * as net from 'net';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/node-specific/operation_examples.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';

import { Code, type MongoClient, ProfilingLevel, ReturnDocument } from '../../../src';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { on, once } from 'node:events';
import { openSync } from 'node:fs';
import { readFile, unlink, writeFile } from 'node:fs/promises';
import * as path from 'node:path';
import * as process from 'node:process';
import { inspect } from 'node:util';

import { AssertionError, expect } from 'chai';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/read-write-concern/write_concern.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import { on, once } from 'events';
import * as sinon from 'sinon';
Expand Down
2 changes: 2 additions & 0 deletions test/integration/uri-options/uri.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as process from 'node:process';

import { expect } from 'chai';
import * as sinon from 'sinon';

Expand Down
Loading