@@ -37,7 +37,7 @@ import {
37
37
import * as assert from 'assert' ;
38
38
import { TediousInstrumentation } from '../src' ;
39
39
import makeApi from './api' ;
40
- import type { Connection , ConnectionConfiguration } from 'tedious ' ;
40
+ import type { tedious } from './api ' ;
41
41
import * as semver from 'semver' ;
42
42
43
43
const port = Number ( process . env . MSSQL_PORT ) || 1433 ;
@@ -50,28 +50,30 @@ const instrumentation = new TediousInstrumentation();
50
50
instrumentation . enable ( ) ;
51
51
instrumentation . disable ( ) ;
52
52
53
- const config : ConnectionConfiguration & { userName : string ; password : string } =
54
- {
55
- userName : user ,
56
- password,
57
- server : host ,
58
- authentication : {
59
- type : 'default' ,
60
- options : {
61
- userName : user ,
62
- password,
63
- } ,
64
- } ,
53
+ const config : tedious [ 'ConnectionConfig' ] & {
54
+ userName : string ;
55
+ password : string ;
56
+ } = {
57
+ userName : user ,
58
+ password,
59
+ server : host ,
60
+ authentication : {
61
+ type : 'default' ,
65
62
options : {
66
- port,
67
- database,
68
- encrypt : true ,
69
- // Required for <11.0.8
70
- trustServerCertificate : true ,
71
- rowCollectionOnRequestCompletion : true ,
72
- rowCollectionOnDone : true ,
63
+ userName : user ,
64
+ password,
73
65
} ,
74
- } ;
66
+ } ,
67
+ options : {
68
+ port,
69
+ database,
70
+ encrypt : true ,
71
+ // Required for <11.0.8
72
+ trustServerCertificate : true ,
73
+ rowCollectionOnRequestCompletion : true ,
74
+ rowCollectionOnDone : true ,
75
+ } ,
76
+ } ;
75
77
76
78
const processVersion = process . version ;
77
79
const tediousVersion = testUtils . getPackageVersion ( 'tedious' ) ;
@@ -85,7 +87,7 @@ const incompatVersions =
85
87
describe ( 'tedious' , ( ) => {
86
88
let tedious : any ;
87
89
let contextManager : AsyncHooksContextManager ;
88
- let connection : Connection ;
90
+ let connection : tedious [ ' Connection' ] ;
89
91
const provider = new BasicTracerProvider ( ) ;
90
92
const shouldTest = process . env . RUN_MSSQL_TESTS ; // For CI: assumes local db is already available
91
93
const shouldTestLocally = process . env . RUN_MSSQL_TESTS_LOCAL ; // For local: spins up local db via docker
@@ -124,7 +126,7 @@ describe('tedious', () => {
124
126
context . setGlobalContextManager ( contextManager ) ;
125
127
instrumentation . setTracerProvider ( provider ) ;
126
128
instrumentation . enable ( ) ;
127
- tedious = makeApi ( require ( 'tedious' ) ) ;
129
+ tedious = makeApi ( require ( 'tedious' ) , tediousVersion ) ;
128
130
connection = await tedious . createConnection ( config ) . catch ( ( err : any ) => {
129
131
console . error ( 'with config:' , config ) ;
130
132
throw err ;
0 commit comments