Skip to content

Commit

Permalink
Do not run fastify >=5 plugin tests in node <=18 (#4737)
Browse files Browse the repository at this point in the history
Co-authored-by: Ugaitz Urien <[email protected]>
  • Loading branch information
juan-fernandez and uurien committed Oct 1, 2024
1 parent e1b671f commit 1a7df27
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/datadog-plugin-cucumber/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Plugin', function () {
let Cucumber
this.timeout(10000)
withVersions('cucumber', '@cucumber/cucumber', (version, _, specificVersion) => {
if ((NODE_MAJOR <= 16) && semver.satisfies(specificVersion, '>=10')) return
if (NODE_MAJOR <= 16 && semver.satisfies(specificVersion, '>=10')) return

afterEach(() => {
// > If you want to run tests multiple times, you may need to clear Node's require cache
Expand Down
5 changes: 4 additions & 1 deletion packages/datadog-plugin-fastify/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const axios = require('axios')
const semver = require('semver')
const { ERROR_MESSAGE, ERROR_STACK, ERROR_TYPE } = require('../../dd-trace/src/constants')
const agent = require('../../dd-trace/test/plugins/agent')
const { NODE_MAJOR } = require('../../../version')

const host = 'localhost'

Expand All @@ -14,7 +15,7 @@ describe('Plugin', () => {
let app

describe('fastify', () => {
withVersions('fastify', 'fastify', version => {
withVersions('fastify', 'fastify', (version, _, specificVersion) => {
beforeEach(() => {
tracer = require('../../dd-trace')
})
Expand All @@ -25,6 +26,8 @@ describe('Plugin', () => {

withExports('fastify', version, ['default', 'fastify'], '>=3', getExport => {
describe('without configuration', () => {
if (NODE_MAJOR <= 18 && semver.satisfies(specificVersion, '>=5')) return

before(() => {
return agent.load(['fastify', 'find-my-way', 'http'], [{}, {}, { client: false }])
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

const semver = require('semver')
const {
FakeAgent,
createSandbox,
Expand All @@ -8,14 +8,17 @@ const {
spawnPluginIntegrationTestProc
} = require('../../../../integration-tests/helpers')
const { assert } = require('chai')
const { NODE_MAJOR } = require('../../../../version')

describe('esm', () => {
let agent
let proc
let sandbox

// skip older versions of fastify due to syntax differences
withVersions('fastify', 'fastify', '>=3', version => {
withVersions('fastify', 'fastify', '>=3', (version, _, specificVersion) => {
if (NODE_MAJOR <= 18 && semver.satisfies(specificVersion, '>=5')) return

before(async function () {
this.timeout(20000)
sandbox = await createSandbox([`'fastify@${version}'`], false,
Expand Down
2 changes: 1 addition & 1 deletion packages/datadog-plugin-undici/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Plugin', () => {
describe('undici-fetch', () => {
withVersions('undici', 'undici', version => {
const specificVersion = require(`../../../versions/undici@${version}`).version()
if ((NODE_MAJOR <= 16) && semver.satisfies(specificVersion, '>=6')) return
if (NODE_MAJOR <= 16 && semver.satisfies(specificVersion, '>=6')) return

function server (app, listener) {
const server = require('http').createServer(app)
Expand Down

0 comments on commit 1a7df27

Please sign in to comment.