Skip to content

Commit e3703f0

Browse files
committed
script and eslint updated
1 parent 4d537b2 commit e3703f0

8 files changed

Lines changed: 80 additions & 27 deletions

File tree

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"root": true,
33
"parser": "@typescript-eslint/parser",
4+
"ignorePatterns": [
5+
"test/tools/runner/bundle/**"
6+
],
47
"parserOptions": {
58
"ecmaVersion": 2023
69
},
@@ -346,4 +349,4 @@
346349
}
347350
}
348351
]
349-
}
352+
}

.evergreen/run-azure-kms-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ export MONGODB_URI="mongodb://localhost:27017"
1818
export EXPECTED_AZUREKMS_OUTCOME=${EXPECTED_AZUREKMS_OUTCOME:-omitted}
1919
export TEST_CSFLE=true
2020

21+
npm run build:bundle
22+
2123
npx mocha --config test/mocha_mongodb.js test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts

.evergreen/run-gcp-kms-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ export MONGODB_URI="mongodb://localhost:27017"
2020
export EXPECTED_GCPKMS_OUTCOME=${EXPECTED_GCPKMS_OUTCOME:-omitted}
2121
export TEST_CSFLE=true
2222

23+
npm run build:bundle
24+
2325
npx mocha --config test/mocha_mongodb.js test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts

.evergreen/run-mongosh-scope-test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ export SCOPES=$(./node_modules/lerna/cli.js ls --all --json)
1313

1414
cd -
1515

16+
npm run build:bundle
17+
1618
npx mocha --config test/manual/mocharc.json test/manual/mongosh_scopes.test.ts

package.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,32 +132,31 @@
132132
"check:bench": "npm --prefix test/benchmarks/driver_bench start",
133133
"check:coverage": "nyc npm run test:all",
134134
"check:integration-coverage": "nyc npm run check:test",
135-
"check:lambda": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js",
136-
"check:lambda:aws": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js",
135+
"check:lambda": "npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js",
136+
"check:lambda:aws": "npm run build:bundle && nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js",
137137
"check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd",
138138
"check:eslint": "npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test",
139139
"check:tsd": "tsd --version && tsd",
140-
"check:dependencies": "mocha test/action/dependency.test.ts",
140+
"check:dependencies": "npm run build:bundle && mocha test/action/dependency.test.ts",
141141
"check:dts": "node ./node_modules/typescript/bin/tsc --target es2023 --module commonjs --noEmit mongodb.d.ts && tsd",
142-
"check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
142+
"check:search-indexes": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
143143
"check:test": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration",
144144
"check:test-bundled": "MONGODB_BUNDLED=true npm run check:test",
145145
"check:unit": "npm run build:bundle && nyc mocha test/unit",
146146
"check:unit-bundled": "MONGODB_BUNDLED=true npm run check:unit",
147147
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
148-
"check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
149-
"check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
150-
"check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts test/integration/auth/mongodb_aws.prose.test.ts",
151-
"check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
152-
"check:oidc-test": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts",
153-
"check:kerberos": "nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts",
154-
"check:tls": "nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts",
155-
"check:ldap": "nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts",
156-
"check:socks5": "nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts",
157-
"check:csfle": "nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption",
158-
"check:snappy": "nyc mocha test/unit/assorted/snappy.test.js",
159-
"check:x509": "nyc mocha test/manual/x509_auth.test.ts",
160-
"check:runtime-independence": "ts-node test/tools/runner/vm_context_helper.ts test/integration/change-streams/change_stream.test.ts",
148+
"check:atlas": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
149+
"check:drivers-atlas-testing": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
150+
"check:aws": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts test/integration/auth/mongodb_aws.prose.test.ts",
151+
"check:oidc-auth": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",
152+
"check:oidc-test": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts",
153+
"check:kerberos": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts",
154+
"check:tls": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts",
155+
"check:ldap": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts",
156+
"check:socks5": "npm run build:bundle && nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts",
157+
"check:csfle": "npm run build:bundle && nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption",
158+
"check:snappy": "npm run build:bundle && nyc mocha test/unit/assorted/snappy.test.js",
159+
"check:x509": "npm run build:bundle && nyc mocha test/manual/x509_auth.test.ts",
161160
"build:bundle": "npm run bundle:driver && npm run bundle:types && npm run build:runtime-barrel",
162161
"build:runtime-barrel": "node etc/build-runtime-barrel.mjs",
163162
"bundle:driver": "node etc/bundle-driver.mjs",

test/mongodb_bundled.ts

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ try {
1111
}
1212

1313
// Export public API from the contextified module
14-
// Hint: This list isn't automatically alphabetized, but VSCode's "Sort Lines Ascending" command can be used to keep it organized
14+
// Hint: This list IS NOT automatically alphabetized
15+
// To re-sort: Highlight the list and use VSCode's "Sort Lines Ascending" command
1516
export const {
1617
abortable,
1718
AbstractCursor,
@@ -378,11 +379,13 @@ export type {
378379
ConnectionOptions,
379380
ConnectionPoolOptions,
380381
ConnectOptions,
382+
CreateIndexesOptions,
381383
DataKey,
382384
DbOptions,
383385
Document,
384386
DriverInfo,
385387
Filter,
388+
IndexDirection,
386389
InferIdType,
387390
KMSProviders,
388391
Log,
@@ -399,8 +402,8 @@ export type {
399402
Runtime,
400403
ServerApi,
401404
ServerSessionId,
405+
Sort,
402406
TagSet,
403-
TopologyOptions,
404407
TopologyVersion,
405408
TransactionOptions,
406409
UpdateDescription,
@@ -425,32 +428,53 @@ import type {
425428
CommandStartedEvent as _CommandStartedEvent,
426429
CommandSucceededEvent as _CommandSucceededEvent,
427430
Connection as _Connection,
431+
ConnectionCheckedInEvent as _ConnectionCheckedInEvent,
432+
ConnectionCheckedOutEvent as _ConnectionCheckedOutEvent,
433+
ConnectionCheckOutFailedEvent as _ConnectionCheckOutFailedEvent,
434+
ConnectionCheckOutStartedEvent as _ConnectionCheckOutStartedEvent,
428435
ConnectionClosedEvent as _ConnectionClosedEvent,
436+
ConnectionCreatedEvent as _ConnectionCreatedEvent,
429437
ConnectionPool as _ConnectionPool,
430438
ConnectionPoolClearedEvent as _ConnectionPoolClearedEvent,
439+
ConnectionPoolClosedEvent as _ConnectionPoolClosedEvent,
440+
ConnectionPoolCreatedEvent as _ConnectionPoolCreatedEvent,
441+
ConnectionPoolReadyEvent as _ConnectionPoolReadyEvent,
442+
ConnectionReadyEvent as _ConnectionReadyEvent,
431443
CSOTTimeoutContext as _CSOTTimeoutContext,
432444
CursorTimeoutContext as _CursorTimeoutContext,
433445
Db as _Db,
434446
FindCursor as _FindCursor,
435447
GridFSBucket as _GridFSBucket,
436448
HostAddress as _HostAddress,
437449
MongoClient as _MongoClient,
450+
MongoCredentials as _MongoCredentials,
438451
MongoError as _MongoError,
439452
OnDemandDocument as _OnDemandDocument,
440453
Server as _Server,
454+
ServerApiVersion as _ServerApiVersion,
455+
ServerClosedEvent as _ServerClosedEvent,
441456
ServerDescription as _ServerDescription,
442457
ServerDescriptionChangedEvent as _ServerDescriptionChangedEvent,
458+
ServerHeartbeatFailedEvent as _ServerHeartbeatFailedEvent,
459+
ServerHeartbeatStartedEvent as _ServerHeartbeatStartedEvent,
460+
ServerHeartbeatSucceededEvent as _ServerHeartbeatSucceededEvent,
461+
ServerOpeningEvent as _ServerOpeningEvent,
462+
ServerSessionPool as _ServerSessionPool,
443463
Timeout as _Timeout,
444464
TimeoutContext as _TimeoutContext,
445465
Topology as _Topology,
466+
TopologyClosedEvent as _TopologyClosedEvent,
446467
TopologyDescription as _TopologyDescription,
447468
TopologyDescriptionChangedEvent as _TopologyDescriptionChangedEvent,
469+
TopologyOpeningEvent as _TopologyOpeningEvent,
470+
TopologyOptions as _TopologyOptions,
448471
TopologyType as _TopologyType,
449472
UUID as _UUID
450473
} from './tools/runner/bundle/types/index';
451474

452475
// Export "clashing" types from the contextified module
453-
// Hint: This list IS NOT automatically alphabetized, but VSCode's "Sort Lines Ascending" command can be used to keep it organized
476+
// Hint: This list IS NOT automatically alphabetized
477+
// To re-sort: Highlight the list and use VSCode's "Sort Lines Ascending" command
454478
export type AbstractCursor = _AbstractCursor;
455479
export type AuthMechanism = _AuthMechanism;
456480
export type ChangeStream = _ChangeStream;
@@ -461,26 +485,46 @@ export type CommandFailedEvent = _CommandFailedEvent;
461485
export type CommandStartedEvent = _CommandStartedEvent;
462486
export type CommandSucceededEvent = _CommandSucceededEvent;
463487
export type Connection = _Connection;
488+
export type ConnectionCheckedInEvent = _ConnectionCheckedInEvent;
489+
export type ConnectionCheckedOutEvent = _ConnectionCheckedOutEvent;
490+
export type ConnectionCheckOutFailedEvent = _ConnectionCheckOutFailedEvent;
491+
export type ConnectionCheckOutStartedEvent = _ConnectionCheckOutStartedEvent;
464492
export type ConnectionClosedEvent = _ConnectionClosedEvent;
493+
export type ConnectionCreatedEvent = _ConnectionCreatedEvent;
465494
export type ConnectionPool = _ConnectionPool;
466495
export type ConnectionPoolClearedEvent = _ConnectionPoolClearedEvent;
496+
export type ConnectionPoolClosedEvent = _ConnectionPoolClosedEvent;
497+
export type ConnectionPoolCreatedEvent = _ConnectionPoolCreatedEvent;
498+
export type ConnectionPoolReadyEvent = _ConnectionPoolReadyEvent;
499+
export type ConnectionReadyEvent = _ConnectionReadyEvent;
467500
export type CSOTTimeoutContext = _CSOTTimeoutContext;
468501
export type CursorTimeoutContext = _CursorTimeoutContext;
469502
export type Db = _Db;
470503
export type FindCursor = _FindCursor;
471504
export type GridFSBucket = _GridFSBucket;
472505
export type HostAddress = _HostAddress;
473506
export type MongoClient = _MongoClient;
507+
export type MongoCredentials = _MongoCredentials;
474508
export type MongoError = _MongoError;
475509
export type OnDemandDocument = _OnDemandDocument;
476510
export type Server = _Server;
511+
export type ServerApiVersion = _ServerApiVersion;
512+
export type ServerClosedEvent = _ServerClosedEvent;
477513
export type ServerDescription = _ServerDescription;
478514
export type ServerDescriptionChangedEvent = _ServerDescriptionChangedEvent;
515+
export type ServerHeartbeatFailedEvent = _ServerHeartbeatFailedEvent;
516+
export type ServerHeartbeatStartedEvent = _ServerHeartbeatStartedEvent;
517+
export type ServerHeartbeatSucceededEvent = _ServerHeartbeatSucceededEvent;
518+
export type ServerOpeningEvent = _ServerOpeningEvent;
519+
export type ServerSessionPool = _ServerSessionPool;
479520
export type Timeout = _Timeout;
480521
export type TimeoutContext = _TimeoutContext;
481522
export type Topology = _Topology;
523+
export type TopologyClosedEvent = _TopologyClosedEvent;
482524
export type TopologyDescription = _TopologyDescription;
483525
export type TopologyDescriptionChangedEvent = _TopologyDescriptionChangedEvent;
526+
export type TopologyOpeningEvent = _TopologyOpeningEvent;
527+
export type TopologyOptions = _TopologyOptions;
484528
export type TopologyType = _TopologyType;
485529
export type UUID = _UUID;
486530

test/tools/runner/vm_context_helper.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ function createRestrictedRequire() {
2727
const methodAndFile = callStack.split('\n')[2];
2828
const match = methodAndFile.match(/at (.*) \((.*)\)/);
2929
const method = match ? match[1] : null;
30-
const sourceFileAndLineNumbers = match ? match[2] : null;
30+
const sourceFileAndLineNumbers = match ? match[2] : 'unknown';
3131
const sourceFile =
32-
sourceFileAndLineNumbers.indexOf('.ts:') !== -1
33-
? sourceFileAndLineNumbers.substring(0, sourceFileAndLineNumbers.lastIndexOf('.ts:') + 3)
34-
: sourceFileAndLineNumbers;
32+
sourceFileAndLineNumbers.indexOf('.ts:') === -1
33+
? sourceFileAndLineNumbers
34+
: sourceFileAndLineNumbers.substring(0, sourceFileAndLineNumbers.lastIndexOf('.ts:') + 3);
3535
const sourceFileName = correctPath.basename(sourceFile);
3636
const isAllowed = allowedRequesters.some(
3737
requester =>
@@ -145,8 +145,8 @@ export function loadContextifiedMongoDBModule() {
145145

146146
const bundleCode = fs.readFileSync(bundlePath, 'utf8');
147147

148-
const exportsContainer = {};
149-
const moduleContainer = { exports: exportsContainer };
148+
const exportsContainer = { __proto__: null };
149+
const moduleContainer = { __proto__: null, exports: exportsContainer };
150150

151151
// Wrap the bundle in a CommonJS-style wrapper
152152
const wrapper = `(function(exports, module, require) {${bundleCode}})`;

test/tools/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { inspect, promisify } from 'util';
1414
import {
1515
type AnyClientBulkWriteModel,
1616
type Document,
17+
EJSON,
1718
type HostAddress,
1819
MongoClient,
1920
type MongoClientOptions,

0 commit comments

Comments
 (0)