Skip to content

Instantly share code, notes, and snippets.

@trentm
Created June 9, 2022 20:24
Show Gist options
  • Save trentm/1fdbdac639d7db58933374d0c269d78a to your computer and use it in GitHub Desktop.
Save trentm/1fdbdac639d7db58933374d0c269d78a to your computer and use it in GitHub Desktop.
diff --git a/.tav.yml b/.tav.yml
index 6c9e61df..2bf15e3a 100644
--- a/.tav.yml
+++ b/.tav.yml
@@ -156,10 +156,17 @@ ws-new:
node: '>=8.6.0'
versions: '>=7 <8'
commands: node test/instrumentation/modules/ws.test.js
+
+graphql-v0.7-v16:
+ preinstall: npm uninstall express-graphql
+ versions: '>=0.7.0 <0.11.0 || >=0.11.1 <16'
+ commands: node test/instrumentation/modules/graphql.test.js
graphql:
preinstall: npm uninstall express-graphql
- versions: '>=0.7.0 <0.11.0 || >=0.11.1 <16.0.0'
+ node: '>=12'
+ versions: '>=16.0.0 <17'
commands: node test/instrumentation/modules/graphql.test.js
+
express:
versions: '>=4'
commands:
diff --git a/docs/supported-technologies.asciidoc b/docs/supported-technologies.asciidoc
index e626851e..be72ca1d 100644
--- a/docs/supported-technologies.asciidoc
+++ b/docs/supported-technologies.asciidoc
@@ -77,7 +77,7 @@ The Node.js agent will automatically instrument the following modules to give yo
|https://www.npmjs.com/package/cassandra-driver[cassandra-driver] |>=3.0.0 <5 |Will instrument all queries
|https://www.npmjs.com/package/elasticsearch[elasticsearch] |>=8.0.0 |Will instrument all queries
|https://www.npmjs.com/package/@elastic/elasticsearch[@elastic/elasticsearch] |>=7.0.0 <9.0.0 |Will instrument all queries
-|https://www.npmjs.com/package/graphql[graphql] |>=0.7.0 <16.0.0 |Will instrument all queries
+|https://www.npmjs.com/package/graphql[graphql] |>=0.7.0 <17 |Will instrument all queries
|https://www.npmjs.com/package/handlebars[handlebars] |* |Will instrument compile and render calls
|https://www.npmjs.com/package/jade[jade] |>=0.5.6 |Will instrument compile and render calls; Deprecated. No longer tested. Use pug.
|https://www.npmjs.com/package/pug[pug] |'>=0.1.0' |Will instrument compile and render calls
diff --git a/lib/instrumentation/modules/graphql.js b/lib/instrumentation/modules/graphql.js
index a59b4ba7..91a049d9 100644
--- a/lib/instrumentation/modules/graphql.js
+++ b/lib/instrumentation/modules/graphql.js
@@ -7,7 +7,7 @@ var getPathFromRequest = require('../express-utils').getPathFromRequest
module.exports = function (graphql, agent, { version, enabled }) {
if (!enabled) return graphql
- if (!semver.satisfies(version, '>=0.7.0 <17.0.0 || ^14.0.0-rc') ||
+ if (!semver.satisfies(version, '>=0.7.0 <17') ||
!graphql.Kind ||
typeof graphql.Source !== 'function' ||
typeof graphql.parse !== 'function' ||
diff --git a/test/instrumentation/modules/graphql.test.js b/test/instrumentation/modules/graphql.test.js
index d8ea1ab3..9ea0f8ba 100644
--- a/test/instrumentation/modules/graphql.test.js
+++ b/test/instrumentation/modules/graphql.test.js
@@ -8,9 +8,14 @@ var agent = require('../../..').start({
centralConfig: false
})
-var graphql = require('graphql')
+const semver = require('semver')
const graphqlVer = require('graphql/package.json').version
-var semver = require('semver')
+if (semver.satisfies(graphqlVer, '>=16') && !semver.satisfies(process.version, '>=12')) {
+ console.log(`# SKIP graphql@${graphqlVer} is incompatible with node ${process.version}`)
+ process.exit()
+}
+
+var graphql = require('graphql')
var test = require('tape')
var mockClient = require('../../_mock_http_client')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment