Skip to content

Commit 7979bd1

Browse files
committed
skip some node-only tests
1 parent 4e62eca commit 7979bd1

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22

3+
import { runOnlyInNodeMetadata } from '../../../tools/utils';
34
import { setupDatabase } from '../../shared';
45

5-
describe('Promote Buffers', function () {
6+
describe('Promote Buffers', runOnlyInNodeMetadata, function () {
67
before(function () {
78
return setupDatabase(this.configuration);
89
});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai';
22

33
import { type Collection, type MongoClient, ObjectId } from '../../../mongodb';
4+
import { runOnlyInNodeMetadata } from '../../../tools/utils';
45

5-
describe('raw bson support', () => {
6+
describe('raw bson support', runOnlyInNodeMetadata, () => {
67
describe('raw', () => {
78
describe('option inheritance', () => {
89
// define client and option for tests to use

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import {
1111
MongoServerError,
1212
OpMsgResponse
1313
} from '../../../mongodb';
14-
describe('class MongoDBResponse', () => {
14+
import { runOnlyInNodeMetadata } from '../../../tools/utils';
15+
16+
describe('class MongoDBResponse', runOnlyInNodeMetadata, () => {
1517
let client;
1618

1719
afterEach(async () => {

test/tools/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
OP_MSG,
2222
processTimeMS,
2323
resolveRuntimeAdapters,
24+
runNodelessTests,
2425
type Runtime,
2526
type ServerApiVersion,
2627
Topology,
@@ -623,3 +624,18 @@ export function configureMongocryptdSpawnHooks(
623624
* A `Runtime` that resolves to entirely Nodejs modules, useful when tests must provide a default `runtime` object to an API.
624625
*/
625626
export const runtime: Runtime = resolveRuntimeAdapters({});
627+
628+
/**
629+
* Metadata that can be used to skip tests in nodeless environments.
630+
*/
631+
export const runOnlyInNodeMetadata: MongoDBMetadataUI = {
632+
requires: {
633+
predicate: _test => {
634+
if (runNodelessTests) {
635+
return 'Test is not node specific and should be run in nodeless environments';
636+
} else {
637+
return true;
638+
}
639+
}
640+
}
641+
};

0 commit comments

Comments
 (0)