diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index 8ec920e463..db7b99ab80 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -56,6 +56,7 @@ "@types/express": "4.17.18", "@types/mocha": "7.0.2", "@types/node": "18.15.3", + "@types/semver": "7.5.5", "fastify": "4.18.0", "mocha": "7.2.0", "nyc": "15.1.0", diff --git a/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts b/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts index d58ae2aea7..8da39fcb31 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts +++ b/plugins/node/opentelemetry-instrumentation-fastify/test/instrumentation.test.ts @@ -449,14 +449,13 @@ describe('fastify', () => { // 'preClose' was added in fastify@4.16.0 if (semver.lt(fastifyVersion, '4.16.0')) { this.skip(); - return; - } - - app.addHook('preClose', () => { - assertRootContextActive(); - }); + } else { + app.addHook('preClose', () => { + assertRootContextActive(); + }); - await startServer(); + await startServer(); + } }); it('onClose is not instrumented', async () => {