Skip to content

Commit

Permalink
feat(instr-tedious): support for >=16 <19
Browse files Browse the repository at this point in the history
  • Loading branch information
david-luna committed May 6, 2024
1 parent ba0de30 commit e40e6c8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tedious:
# 4.0.0 is broken: https://github.com/tediousjs/tedious/commit/4eceb48
versions: "1.11.0 || 1.14.0 || 2.7.1 || 3.0.1 || 4.2.0 || ^6.7.0 || 8.3.0 || 9.2.3 || 11.0.9 || 11.2.0 || 11.4.0 || ^11.8.0 || ^12.3.0 || ^13.2.0 || ^14.0.0 || ^15.0.0"
versions: "1.11.0 || 1.14.0 || 2.7.1 || 3.0.1 || 4.2.0 || ^6.7.0 || 8.3.0 || 9.2.3 || 11.0.9 || 11.2.0 || 11.4.0 || ^11.8.0 || ^12.3.0 || ^13.2.0 || >=14 <19"
commands: npm run test
2 changes: 1 addition & 1 deletion plugins/node/instrumentation-tedious/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-tedious

## Supported Versions

- `>=1.11.0 <=15`
- `>=1.11.0 <=19`

## Usage

Expand Down
2 changes: 2 additions & 0 deletions plugins/node/instrumentation-tedious/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"docker:start": "docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=mssql_passw0rd -e MSSQL_PID=Developer --platform linux/amd64 --rm mcr.microsoft.com/mssql/server",
"clean": "rimraf build/*",
"compile": "tsc -p .",
"lint:fix": "eslint . --ext .ts --fix",
Expand Down Expand Up @@ -56,6 +57,7 @@
"mocha": "7.2.0",
"nyc": "15.1.0",
"rimraf": "5.0.5",
"semver": "^7.6.0",
"tedious": "15.1.3",
"test-all-versions": "6.1.0",
"ts-mocha": "10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class TediousInstrumentation extends InstrumentationBase {
return [
new InstrumentationNodeModuleDefinition(
TediousInstrumentation.COMPONENT,
['>=1.11.0 <=15'],
['>=1.11.0 <=19'],
(moduleExports: typeof tedious) => {
const ConnectionPrototype: any = moduleExports.Connection.prototype;
for (const method of PATCHED_METHODS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import * as assert from 'assert';
import { TediousInstrumentation } from '../src';
import makeApi from './api';
import type { Connection, ConnectionConfig } from 'tedious';
import * as semver from 'semver';

const port = Number(process.env.MSSQL_PORT) || 1433;
const database = process.env.MSSQL_DATABASE || 'master';
Expand Down Expand Up @@ -71,6 +72,14 @@ const config: ConnectionConfig & { userName: string; password: string } = {
},
};

const processVersion = process.version;
const tediousVersion = testUtils.getPackageVersion('../../../');
const incompatVersions =
// tedious@16 removed support for node v14 https://github.com/tediousjs/tedious/releases/tag/v16.0.0
(semver.lt(processVersion, '15.0.0') && semver.gte(tediousVersion, '16.0.0')) ||
// tedious@17 removed support for node v16 and v19 https://github.com/tediousjs/tedious/releases/tag/v17.0.0
(semver.lt(processVersion, '17.0.0') && semver.gte(tediousVersion, '17.0.0'));

describe('tedious', () => {
let tedious: any;
let contextManager: AsyncHooksContextManager;
Expand All @@ -81,7 +90,7 @@ describe('tedious', () => {
const memoryExporter = new InMemorySpanExporter();

before(function (done) {
if (!(shouldTest || shouldTestLocally)) {
if (!(shouldTest || shouldTestLocally) || incompatVersions) {
// this.skip() workaround
// https://github.com/mochajs/mocha/issues/2683#issuecomment-375629901
this.test!.parent!.pending = true;
Expand Down

0 comments on commit e40e6c8

Please sign in to comment.