diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 0950cf6403e..2a029abdc07 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -4468,7 +4468,6 @@ buildvariants: - test-tls-support-5.0 - test-tls-support-4.4 - test-tls-support-4.2 - disable: true - name: windows-vsCurrent-large-gallium display_name: Windows Node16 run_on: windows-vsCurrent-large diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index e28f74f1d2f..c885865e344 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -442,8 +442,6 @@ for (const { run_on, expansions: { NODE_LTS_VERSION: 'latest' }, tasks: tasks.map(({ name }) => name), - // TODO(NODE-6641): Unskip the smoke tests - disable: true }; if (clientEncryption) { buildVariantData.expansions.CLIENT_ENCRYPTION = true; diff --git a/.evergreen/run-azure-kms-tests.sh b/.evergreen/run-azure-kms-tests.sh index 3168f7b0bb3..c8818962d48 100644 --- a/.evergreen/run-azure-kms-tests.sh +++ b/.evergreen/run-azure-kms-tests.sh @@ -18,4 +18,4 @@ export MONGODB_URI="mongodb://localhost:27017" export EXPECTED_AZUREKMS_OUTCOME=${EXPECTED_AZUREKMS_OUTCOME:-omitted} export TEST_CSFLE=true -npx mocha --config test/mocha_mongodb.json test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts +npx mocha --config test/mocha_mongodb.js test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts diff --git a/.evergreen/run-gcp-kms-tests.sh b/.evergreen/run-gcp-kms-tests.sh index 3f932681ea3..ecc88e535e3 100644 --- a/.evergreen/run-gcp-kms-tests.sh +++ b/.evergreen/run-gcp-kms-tests.sh @@ -20,4 +20,4 @@ export MONGODB_URI="mongodb://localhost:27017" export EXPECTED_GCPKMS_OUTCOME=${EXPECTED_GCPKMS_OUTCOME:-omitted} export TEST_CSFLE=true -npx mocha --config test/mocha_mongodb.json test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts +npx mocha --config test/mocha_mongodb.js test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts diff --git a/.evergreen/run-serverless-tests.sh b/.evergreen/run-serverless-tests.sh index b134fd4be66..1799b34db30 100755 --- a/.evergreen/run-serverless-tests.sh +++ b/.evergreen/run-serverless-tests.sh @@ -17,7 +17,7 @@ if [ -z ${SERVERLESS_ATLAS_USER+omitted} ]; then echo "SERVERLESS_ATLAS_USER is if [ -z ${SERVERLESS_ATLAS_PASSWORD+omitted} ]; then echo "SERVERLESS_ATLAS_PASSWORD is unset" && exit 1; fi npx mocha \ - --config test/mocha_mongodb.json \ + --config test/mocha_mongodb.js \ test/integration/crud/crud.spec.test.ts \ test/integration/crud/crud.prose.test.ts \ test/integration/retryable-reads/retryable_reads.spec.test.ts \ diff --git a/.mocharc.js b/.mocharc.js new file mode 100644 index 00000000000..a289ec1a9de --- /dev/null +++ b/.mocharc.js @@ -0,0 +1,21 @@ +'use strict'; + +const [major] = process.versions.node.split('.'); + +/** @type {import("mocha").MochaOptions} */ +module.exports = { + require: [ + 'source-map-support/register', + 'ts-node/register', + 'test/tools/runner/chai_addons.ts', + 'test/tools/runner/ee_checker.ts' + ], + extension: ['js', 'ts'], + recursive: true, + timeout: 60000, + failZero: true, + reporter: 'test/tools/reporter/mongodb_reporter.js', + sort: true, + color: true, + 'node-option': Number(major) >= 23 ? ['no-experimental-strip-types'] : undefined +}; diff --git a/.mocharc.json b/.mocharc.json deleted file mode 100644 index eae1c0b935e..00000000000 --- a/.mocharc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/mocharc.json", - "require": [ - "source-map-support/register", - "ts-node/register", - "test/tools/runner/chai_addons.ts", - "test/tools/runner/ee_checker.ts" - ], - "extension": [ - "js", - "ts" - ], - "recursive": true, - "timeout": 60000, - "failZero": true, - "reporter": "test/tools/reporter/mongodb_reporter.js", - "sort": true, - "color": true -} diff --git a/package.json b/package.json index 54d367ae774..90c03767498 100644 --- a/package.json +++ b/package.json @@ -132,32 +132,32 @@ "check:bench": "npm --prefix test/benchmarks/driver_bench start", "check:coverage": "nyc npm run test:all", "check:integration-coverage": "nyc npm run check:test", - "check:lambda": "mocha --config test/mocha_lambda.json test/integration/node-specific/examples/handler.test.js", - "check:lambda:aws": "mocha --config test/mocha_lambda.json test/integration/node-specific/examples/aws_handler.test.js", + "check:lambda": "mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js", + "check:lambda:aws": "mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js", "check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd", "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", "check:tsd": "tsd --version && tsd", "check:dependencies": "mocha test/action/dependency.test.ts", "check:dts": "node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd", - "check:search-indexes": "nyc mocha --config test/mocha_mongodb.json test/manual/search-index-management.prose.test.ts", - "check:test": "mocha --config test/mocha_mongodb.json test/integration", + "check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts", + "check:test": "mocha --config test/mocha_mongodb.js test/integration", "check:unit": "mocha test/unit", "check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit", - "check:atlas": "mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.ts", - "check:resource-management": "mocha --config test/manual/mocharc.json test/manual/resource_management.test.ts", - "check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.json test/atlas/drivers_atlas_testing.test.ts", - "check:adl": "mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing", - "check:aws": "nyc mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.ts", - "check:oidc-auth": "mocha --config test/mocha_mongodb.json test/integration/auth/auth.spec.test.ts", - "check:oidc-test": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc.prose.test.ts", - "check:oidc-azure": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_azure.prose.05.test.ts", - "check:oidc-gcp": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts", - "check:oidc-k8s": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts", - "check:kerberos": "nyc mocha --config test/manual/mocharc.json test/manual/kerberos.test.ts", - "check:tls": "mocha --config test/manual/mocharc.json test/manual/tls_support.test.ts", - "check:ldap": "nyc mocha --config test/manual/mocharc.json test/manual/ldap.test.ts", - "check:socks5": "mocha --config test/manual/mocharc.json test/manual/socks5.test.ts", - "check:csfle": "mocha --config test/mocha_mongodb.json test/integration/client-side-encryption", + "check:atlas": "mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts", + "check:resource-management": "mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts", + "check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts", + "check:adl": "mocha --config test/mocha_mongodb.js test/manual/atlas-data-lake-testing", + "check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts", + "check:oidc-auth": "mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts", + "check:oidc-test": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts", + "check:oidc-azure": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_azure.prose.05.test.ts", + "check:oidc-gcp": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts", + "check:oidc-k8s": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts", + "check:kerberos": "nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts", + "check:tls": "mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts", + "check:ldap": "nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts", + "check:socks5": "mocha --config test/manual/mocharc.js test/manual/socks5.test.ts", + "check:csfle": "mocha --config test/mocha_mongodb.js test/integration/client-side-encryption", "check:snappy": "mocha test/unit/assorted/snappy.test.js", "check:x509": "mocha test/manual/x509_auth.test.ts", "fix:eslint": "npm run check:eslint -- --fix", diff --git a/test/manual/mocharc.js b/test/manual/mocharc.js new file mode 100644 index 00000000000..04c59052424 --- /dev/null +++ b/test/manual/mocharc.js @@ -0,0 +1,13 @@ +'use strict'; + +const [major] = process.versions.node.split('.'); + +/** @type {import("mocha").MochaOptions} */ +module.exports = { + require: ['ts-node/register', 'test/tools/runner/chai_addons.ts'], + reporter: 'test/tools/reporter/mongodb_reporter.js', + failZero: true, + color: true, + timeout: 10000, + 'node-option': Number(major) >= 23 ? ['no-experimental-strip-types'] : undefined +}; diff --git a/test/manual/mocharc.json b/test/manual/mocharc.json deleted file mode 100644 index 08a1a88d8e8..00000000000 --- a/test/manual/mocharc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "require": [ - "ts-node/register", - "test/tools/runner/chai_addons.ts" - ], - "reporter": "test/tools/reporter/mongodb_reporter.js", - "failZero": true, - "color": true, - "timeout": 10000 -} diff --git a/test/mocha_lambda.js b/test/mocha_lambda.js new file mode 100644 index 00000000000..cb1079aed33 --- /dev/null +++ b/test/mocha_lambda.js @@ -0,0 +1,17 @@ +'use strict'; + +const [major] = process.versions.node.split('.'); + +/** @type {import("mocha").MochaOptions} */ +module.exports = { + require: ['test/integration/node-specific/examples/setup.js'], + extension: ['js'], + ui: 'test/tools/runner/metadata_ui.js', + recursive: true, + timeout: 6000, + failZero: true, + reporter: 'test/tools/reporter/mongodb_reporter.js', + sort: true, + color: true, + 'node-option': Number(major) >= 23 ? ['no-experimental-strip-types'] : undefined +}; diff --git a/test/mocha_lambda.json b/test/mocha_lambda.json deleted file mode 100644 index 53ec17874ee..00000000000 --- a/test/mocha_lambda.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/mocharc.json", - "require": [ - "test/integration/node-specific/examples/setup.js" - ], - "extension": ["js"], - "ui": "test/tools/runner/metadata_ui.js", - "recursive": true, - "timeout": 6000, - "failZero": true, - "reporter": "test/tools/reporter/mongodb_reporter.js", - "sort": true, - "color": true -} diff --git a/test/mocha_mongodb.js b/test/mocha_mongodb.js new file mode 100644 index 00000000000..eeb18ae4f8d --- /dev/null +++ b/test/mocha_mongodb.js @@ -0,0 +1,32 @@ +'use strict'; + +const [major] = process.versions.node.split('.'); + +/** @type {import("mocha").MochaOptions} */ +module.exports = { + require: [ + 'source-map-support/register', + 'ts-node/register', + 'test/tools/runner/chai_addons.ts', + 'test/tools/runner/ee_checker.ts', + 'test/tools/runner/hooks/configuration.ts', + 'test/tools/runner/hooks/leak_checker.ts', + 'test/tools/runner/hooks/legacy_crud_shims.ts' + ], + extension: ['js', 'ts'], + ui: 'test/tools/runner/metadata_ui.js', + recursive: true, + timeout: 60000, + failZero: true, + reporter: 'test/tools/reporter/mongodb_reporter.js', + sort: true, + color: true, + ignore: [ + 'test/integration/node-specific/examples/handler.js', + 'test/integration/node-specific/examples/handler.test.js', + 'test/integration/node-specific/examples/aws_handler.js', + 'test/integration/node-specific/examples/aws_handler.test.js', + 'test/integration/node-specific/examples/setup.js' + ], + 'node-option': Number(major) >= 23 ? ['no-experimental-strip-types'] : undefined +}; diff --git a/test/mocha_mongodb.json b/test/mocha_mongodb.json deleted file mode 100644 index bab33041991..00000000000 --- a/test/mocha_mongodb.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/mocharc.json", - "require": [ - "source-map-support/register", - "ts-node/register", - "test/tools/runner/ee_checker.ts", - "test/tools/runner/chai_addons.ts", - "test/tools/runner/hooks/configuration.ts", - "test/tools/runner/hooks/leak_checker.ts", - "test/tools/runner/hooks/legacy_crud_shims.ts" - ], - "extension": [ - "js", - "ts" - ], - "ui": "test/tools/runner/metadata_ui.js", - "recursive": true, - "timeout": 60000, - "failZero": true, - "reporter": "test/tools/reporter/mongodb_reporter.js", - "sort": true, - "color": true, - "ignore": [ - "test/integration/node-specific/examples/handler.js", - "test/integration/node-specific/examples/handler.test.js", - "test/integration/node-specific/examples/aws_handler.js", - "test/integration/node-specific/examples/aws_handler.test.js", - "test/integration/node-specific/examples/setup.js" - ] -}