Skip to content

Commit 1c62069

Browse files
Merge branch 'main' into NODE-3681/current-date-type
2 parents 366eee9 + 8b91c30 commit 1c62069

11 files changed

+81
-33
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
"@typescript-eslint",
1111
"prettier",
1212
"unused-imports",
13-
"tsdoc"
13+
"tsdoc",
14+
"mocha"
1415
],
1516
"extends": [
1617
"eslint:recommended",
1718
"plugin:@typescript-eslint/eslint-recommended",
1819
"plugin:@typescript-eslint/recommended",
1920
"plugin:prettier/recommended"
21+
// "plugin:mocha/recommended"
2022
],
2123
"env": {
2224
"node": true,
@@ -112,6 +114,7 @@
112114
]
113115
}
114116
],
117+
"mocha/no-async-describe": "error",
115118
"no-restricted-syntax": [
116119
"error",
117120
{

package-lock.json

Lines changed: 54 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"eslint": "^8.56.0",
8989
"eslint-config-prettier": "^8.10.0",
9090
"eslint-plugin-import": "^2.29.1",
91+
"eslint-plugin-mocha": "^10.4.1",
9192
"eslint-plugin-prettier": "^4.2.1",
9293
"eslint-plugin-simple-import-sort": "^10.0.0",
9394
"eslint-plugin-tsdoc": "^0.2.17",

test/atlas/drivers_atlas_testing.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { runUnifiedSuite } from '../tools/unified-spec-runner/runner';
22

3-
describe('Node Driver Atlas Testing', async function () {
3+
describe('Node Driver Atlas Testing', function () {
44
// Astrolabe can, well, take some time. In some cases up to 800s to
55
// reconfigure clusters.
66
this.timeout(0);

test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { EJSON } from 'bson';
22
import { expect } from 'chai';
33
import { readFile } from 'fs/promises';
44
import { join } from 'path';
5-
import * as semver from 'semver';
65

76
import { Decimal128, type Document, Double, Long, type MongoClient } from '../../../src';
87
/* eslint-disable @typescript-eslint/no-restricted-imports */
@@ -25,7 +24,9 @@ const metaData: MongoDBMetadataUI = {
2524

2625
// The Range Explicit Encryption tests require MongoDB server 7.0+ for QE v2.
2726
// The tests must not run against a standalone.
28-
mongodb: '>=7.0.0',
27+
//
28+
// `rangePreview` is not supported on 8.0+ servers.
29+
mongodb: '>=7.0.0 <8.0.0',
2930
topology: '!single'
3031
}
3132
};
@@ -127,14 +128,6 @@ const readEncryptedFieldsFile = (dataType: string): Promise<string> =>
127128
describe('Range Explicit Encryption', function () {
128129
installNodeDNSWorkaroundHooks();
129130

130-
beforeEach(async function () {
131-
if (semver.gte(this.configuration.version, '7.999.999')) {
132-
if (this.currentTest)
133-
this.currentTest.skipReason = 'TODO(NODE-5908): skip rangePreview tests on server 8.0+';
134-
return this.currentTest?.skip();
135-
}
136-
});
137-
138131
let clientEncryption;
139132
let keyId;
140133
let keyVaultClient;
@@ -145,7 +138,7 @@ describe('Range Explicit Encryption', function () {
145138
let encryptedTwoHundred;
146139
let compareNumericValues;
147140
for (const { type: dataType, rangeOptions, factory } of dataTypes) {
148-
context(`datatype ${dataType}`, async function () {
141+
context(`datatype ${dataType}`, function () {
149142
beforeEach(async function () {
150143
compareNumericValues = function (value: unknown, expected: number): void {
151144
if (dataType === 'DoubleNoPrecision' || dataType === 'DoublePrecision') {

test/integration/crud/abstract_operation.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { executeOperation, Long, Server } from '../../mongodb';
55
import * as mongodb from '../../mongodb';
66
import { topologyWithPlaceholderClient } from '../../tools/utils';
77

8-
describe('abstract operation', async function () {
9-
describe('command name getter', async function () {
8+
describe('abstract operation', function () {
9+
describe('command name getter', function () {
1010
interface AbstractOperationSubclasses {
1111
subclassCreator: () => mongodb.AbstractOperation;
1212
subclassType: any;
@@ -312,7 +312,7 @@ describe('abstract operation', async function () {
312312
});
313313

314314
for (const { subclassCreator, subclassType, correctCommandName } of subclassArray) {
315-
context(`when subclass is ${subclassType.name}`, async function () {
315+
context(`when subclass is ${subclassType.name}`, function () {
316316
it(`operation.commandName equals correct string`, async function () {
317317
const subclassInstance = subclassCreator();
318318
expect(subclassInstance.commandName).to.equal(correctCommandName);

test/integration/node-specific/bson-options/use_bigint_64.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('useBigInt64 option', function () {
2828
}
2929
});
3030

31-
describe('when not provided to client', async function () {
31+
describe('when not provided to client', function () {
3232
beforeEach(async function () {
3333
client = await this.configuration.newClient().connect();
3434
});
@@ -92,7 +92,7 @@ describe('useBigInt64 option', function () {
9292
});
9393
});
9494

95-
describe('when set to true at collection level', async function () {
95+
describe('when set to true at collection level', function () {
9696
let res: WithId<BSON.Document> | null;
9797
beforeEach(async function () {
9898
client = await this.configuration.newClient().connect();
@@ -110,7 +110,7 @@ describe('useBigInt64 option', function () {
110110
});
111111
});
112112

113-
describe('when set to false at collection level', async function () {
113+
describe('when set to false at collection level', function () {
114114
let res: WithId<BSON.Document> | null;
115115
beforeEach(async function () {
116116
client = await this.configuration.newClient().connect();

test/unit/cmap/connect.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ describe('Connect Tests', function () {
224224
expect(handshakeDocument.client.env).to.not.have.property('name');
225225
});
226226

227-
context('when 512 byte size limit is exceeded', async () => {
227+
context('when 512 byte size limit is exceeded', () => {
228228
it(`should not 'env' property in client`, async () => {
229229
// make metadata = 507 bytes, so it takes up entire LimitedSizeDocument
230230
const longAppName = 's'.repeat(493);
@@ -274,7 +274,7 @@ describe('Connect Tests', function () {
274274
expect(handshakeDocument.client.env.name).to.equal('aws.lambda');
275275
});
276276

277-
context('when 512 byte size limit is exceeded', async () => {
277+
context('when 512 byte size limit is exceeded', () => {
278278
it(`should not have 'container' property in client.env`, async () => {
279279
// make metadata = 507 bytes, so it takes up entire LimitedSizeDocument
280280
const longAppName = 's'.repeat(447);

test/unit/commands.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe('class OpCompressedRequest', () => {
172172
});
173173
});
174174

175-
context('toBin()', async () => {
175+
context('toBin()', () => {
176176
for (const protocol of [OpMsgRequest, OpQueryRequest]) {
177177
context(`when ${protocol.name} is used`, () => {
178178
let msg;

test/unit/mongo_logger.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('meta tests for BufferingStream', function () {
5757
});
5858
});
5959

60-
describe('class MongoLogger', async function () {
60+
describe('class MongoLogger', function () {
6161
describe('#constructor()', function () {
6262
it('assigns each property from the options object onto the logging class', function () {
6363
const componentSeverities: MongoLoggerOptions['componentSeverities'] = {
@@ -1353,7 +1353,7 @@ describe('class MongoLogger', async function () {
13531353
});
13541354
});
13551355

1356-
describe('log', async function () {
1356+
describe('log', function () {
13571357
let componentSeverities: MongoLoggerOptions['componentSeverities'];
13581358

13591359
beforeEach(function () {
@@ -1407,7 +1407,7 @@ describe('class MongoLogger', async function () {
14071407
});
14081408
});
14091409
});
1410-
describe('async stream failure handling', async function () {
1410+
describe('async stream failure handling', function () {
14111411
context('when stream is not stderr', function () {
14121412
let stderrStub;
14131413

@@ -1419,7 +1419,7 @@ describe('class MongoLogger', async function () {
14191419
sinon.restore();
14201420
});
14211421

1422-
context('when stream user defined stream and stream.write throws async', async function () {
1422+
context('when stream user defined stream and stream.write throws async', function () {
14231423
it('should catch error, not crash application, warn user, and start writing to stderr', async function () {
14241424
const stream = {
14251425
async write(_log) {
@@ -1456,7 +1456,7 @@ describe('class MongoLogger', async function () {
14561456
});
14571457
});
14581458

1459-
context('when stream is stdout and stdout.write throws', async function () {
1459+
context('when stream is stdout and stdout.write throws', function () {
14601460
it('should catch error, not crash application, warn user, and start writing to stderr', async function () {
14611461
sinon.stub(process.stdout, 'write').throws(new Error('I am stdout and do not work'));
14621462
// print random message at the debug level
@@ -1509,7 +1509,7 @@ describe('class MongoLogger', async function () {
15091509
});
15101510
});
15111511
});
1512-
context('when async stream has multiple logs with different timeouts', async function () {
1512+
context('when async stream has multiple logs with different timeouts', function () {
15131513
it('should preserve their order', async function () {
15141514
const stream = {
15151515
buffer: [],

test/unit/sdam/server_selection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
import * as mock from '../../tools/mongodb-mock/index';
1818
import { topologyWithPlaceholderClient } from '../../tools/utils';
1919

20-
describe('server selection', async function () {
20+
describe('server selection', function () {
2121
const primary = new ServerDescription('127.0.0.1:27017', {
2222
setName: 'test',
2323
isWritablePrimary: true,
@@ -610,7 +610,7 @@ describe('server selection', async function () {
610610
});
611611
});
612612

613-
describe('server selection logging feature flagging', async function () {
613+
describe('server selection logging feature flagging', function () {
614614
let mockServer;
615615
let topology;
616616
let address;

0 commit comments

Comments
 (0)