diff --git a/test/versioned/mongodb/collection-common.js b/test/versioned/mongodb/collection-common.js index 24749d8173..91b35483c5 100644 --- a/test/versioned/mongodb/collection-common.js +++ b/test/versioned/mongodb/collection-common.js @@ -8,6 +8,7 @@ const common = require('./common') const tap = require('tap') const helper = require('../../lib/agent_helper') +const mongoPackage = require('mongodb/package.json') let METRIC_HOST_NAME = null let METRIC_HOST_PORT = null @@ -17,6 +18,7 @@ exports.close = common.close exports.test = collectionTest exports.dropTestCollections = dropTestCollections exports.populate = populate +exports.pkgVersion = mongoPackage.version const { COLLECTIONS } = common diff --git a/test/versioned/mongodb/collection-misc.tap.js b/test/versioned/mongodb/collection-misc.tap.js index 7ad73de48a..cfd7f4a46e 100644 --- a/test/versioned/mongodb/collection-misc.tap.js +++ b/test/versioned/mongodb/collection-misc.tap.js @@ -7,7 +7,7 @@ const common = require('./collection-common') const semver = require('semver') -const { pkgVersion, STATEMENT_PREFIX, COLLECTIONS, DB_NAME } = require('./common') +const { STATEMENT_PREFIX, COLLECTIONS, DB_NAME } = require('./common') function verifyAggregateData(t, data) { t.equal(data.length, 3, 'should have expected amount of results') @@ -87,7 +87,7 @@ common.test('rename', async function renameTest(t, collection, verify) { verify(null, [`${STATEMENT_PREFIX}/rename`], ['rename'], { strict: false }) }) -if (semver.satisfies(pkgVersion, '<6.0.0')) { +if (semver.satisfies(common.pkgVersion, '<6.0.0')) { common.test('stats', async function statsTest(t, collection, verify) { const data = await collection.stats({ i: 5 }) t.equal(data.ns, `${DB_NAME}.${COLLECTIONS.collection1}`) @@ -98,7 +98,7 @@ if (semver.satisfies(pkgVersion, '<6.0.0')) { }) } -if (semver.satisfies(pkgVersion, '<5.0.0')) { +if (semver.satisfies(common.pkgVersion, '<5.0.0')) { common.test('mapReduce', async function mapReduceTest(t, collection, verify) { const data = await collection.mapReduce(map, reduce, { out: { inline: 1 } }) diff --git a/test/versioned/mongodb/collection-update.tap.js b/test/versioned/mongodb/collection-update.tap.js index 78d60e602b..1ceef321db 100644 --- a/test/versioned/mongodb/collection-update.tap.js +++ b/test/versioned/mongodb/collection-update.tap.js @@ -7,7 +7,7 @@ const common = require('./collection-common') const semver = require('semver') -const { pkgVersion, STATEMENT_PREFIX } = require('./common') +const { STATEMENT_PREFIX } = require('./common') /** * The response from the methods in this file differ between versions @@ -132,7 +132,7 @@ common.test('updateOne', async function updateOneTest(t, collection, verify) { verify(null, [`${STATEMENT_PREFIX}/updateOne`], ['updateOne'], { strict: false }) }) -if (semver.satisfies(pkgVersion, '<5.0.0')) { +if (semver.satisfies(common.pkgVersion, '<5.0.0')) { common.test('insert', async function insertTest(t, collection, verify) { const data = await collection.insert({ foo: 'bar' }) assertExpectedResult({ diff --git a/test/versioned/mongodb/common.js b/test/versioned/mongodb/common.js index e4e3c0fb62..dee7cb35b6 100644 --- a/test/versioned/mongodb/common.js +++ b/test/versioned/mongodb/common.js @@ -5,7 +5,6 @@ 'use strict' -const mongoPackage = require('mongodb/package.json') const params = require('../../lib/params') const urltils = require('../../../lib/util/urltils') @@ -26,7 +25,6 @@ exports.TRANSACTION_NAME = TRANSACTION_NAME exports.DB_NAME = DB_NAME exports.COLLECTIONS = COLLECTIONS exports.STATEMENT_PREFIX = STATEMENT_PREFIX -exports.pkgVersion = mongoPackage.version exports.connect = connect exports.close = close