Skip to content

Commit

Permalink
fix: test crash with [email protected] and node v10 (#2303)
Browse files Browse the repository at this point in the history
[email protected] dropped support for node v10. However, it wasn't until
v4.1.1 that it failed in usage with the latest node v10.
  • Loading branch information
trentm authored Aug 25, 2021
1 parent c44cedb commit 0f28a16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,9 @@ test('disableInstrumentations', function (t) {
if (semver.lt(process.version, '10.0.0') && semver.gte(esVersion, '7.12.0')) {
modules.delete('@elastic/elasticsearch')
}
// require('mongodb') is a hard crash on nodes < 10.4
// As of mongodb@4 only supports node >=v12.
const mongodbVersion = require('../node_modules/mongodb/package.json').version
if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '10.4.0')) {
if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '12.0.0')) {
modules.delete('mongodb')
}

Expand Down
4 changes: 2 additions & 2 deletions test/instrumentation/modules/mongodb.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const agent = require('../../..').start({
cloudProvider: 'none'
})

// require('mongodb') is a hard crash on nodes <10.4
// As of mongodb@4 only supports node >=v12.
const mongodbVersion = require('../../../node_modules/mongodb/package.json').version
const semver = require('semver')
if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '10.4.0')) {
if (semver.gte(mongodbVersion, '4.0.0') && semver.lt(process.version, '12.0.0')) {
console.log(`# SKIP mongodb@${mongodbVersion} does not support node ${process.version}`)
process.exit()
}
Expand Down

0 comments on commit 0f28a16

Please sign in to comment.