Skip to content

Commit 875174b

Browse files
committed
improve tooling and migrate timeout.test.ts to new format
1 parent 7f2bd34 commit 875174b

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts",
143143
"check:test": "mocha --config test/mocha_mongodb.js test/integration",
144144
"check:unit": "nyc mocha test/unit",
145-
"check:unit-bundled": "MONGODB_BUNDLED=true npm run build:bundle && npm run check:unit",
145+
"check:unit-bundled": "npm run switch:to-bundled && npm run check:unit || npm run switch:to-unbundled",
146146
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
147147
"check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
148148
"check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
@@ -157,14 +157,16 @@
157157
"check:snappy": "nyc mocha test/unit/assorted/snappy.test.js",
158158
"check:x509": "nyc mocha test/manual/x509_auth.test.ts",
159159
"check:runtime-independence": "ts-node test/tools/runner/vm_context_helper.ts test/integration/change-streams/change_stream.test.ts",
160-
"check:test-bundled": "MONGODB_BUNDLED=true npm run build:bundle && npm run check:test",
160+
"check:test-bundled": "npm run switch:to-bundled && npm run check:test || npm run switch:to-unbundled",
161161
"build:bundle": "npm run bundle:driver && npm run bundle:types && npm run build:runtime-barrel",
162162
"build:runtime-barrel": "node etc/build-runtime-barrel.mjs",
163163
"bundle:driver": "node etc/bundle-driver.mjs",
164164
"bundle:types": "npx tsc --project ./tsconfig.json --declaration --emitDeclarationOnly --declarationDir test/tools/runner/bundle/types",
165165
"fix:eslint": "npm run check:eslint -- --fix",
166166
"prepare": "node etc/prepare.js",
167167
"preview:docs": "ts-node etc/docs/preview.ts",
168+
"switch:to-bundled": "MONGODB_BUNDLED=true npm run build:runtime-barrel",
169+
"switch:to-unbundled": "MONGODB_BUNDLED=false npm run build:runtime-barrel",
168170
"test": "npm run check:lint && npm run test:all",
169171
"test:all": "npm run check:unit && npm run check:test",
170172
"update:docs": "npm run build:docs -- --yes"

test/mongodb_bundled.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export const {
1717
CommandFailedEvent,
1818
CommandStartedEvent,
1919
CommandSucceededEvent,
20+
CSOTTimeoutContext,
2021
Db,
2122
Double,
2223
HostAddress,
2324
isHello,
25+
LegacyTimeoutContext,
2426
Long,
2527
MongoAPIError,
2628
MongoBulkWriteError,
@@ -31,6 +33,7 @@ export const {
3133
MongoLogger,
3234
MongoParseError,
3335
MongoServerError,
36+
MongoRuntimeError,
3437
ObjectId,
3538
parseOptions,
3639
ReadConcern,
@@ -39,6 +42,9 @@ export const {
3942
ReturnDocument,
4043
ServerApiVersion,
4144
SeverityLevel,
45+
Timeout,
46+
TimeoutContext,
47+
TimeoutError,
4248
TopologyType,
4349
WriteConcern
4450
} = exportSource;
@@ -61,6 +67,7 @@ import type {
6167
CommandSucceededEvent as _CommandSucceededEventType,
6268
HostAddress as _HostAddressType,
6369
MongoClient as _MongoClientType,
70+
Timeout as _TimeoutType,
6471
TopologyType as _TopologyType
6572
} from './tools/runner/bundle/types/index';
6673
export type Collection = _CollectionType;
@@ -69,4 +76,5 @@ export type CommandStartedEvent = _CommandStartedEventType;
6976
export type CommandSucceededEvent = _CommandSucceededEventType;
7077
export type HostAddress = _HostAddressType;
7178
export type MongoClient = _MongoClientType;
79+
export type Timeout = _TimeoutType;
7280
export type TopologyType = _TopologyType;

test/mongodb_runtime-testing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// This file is auto-generated. Do not edit.
22
// Run 'npm run build:runtime-barrel' to regenerate.
3-
export const runNodelessTests = true;
4-
export * from './mongodb_bundled';
3+
export const runNodelessTests = false;
4+
export * from './mongodb';

test/unit/timeout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
Timeout,
99
TimeoutContext,
1010
TimeoutError
11-
} from '../mongodb';
11+
} from '../mongodb_runtime-testing';
1212

1313
describe('Timeout', function () {
1414
let timeout: Timeout;

0 commit comments

Comments
 (0)