@@ -61,19 +61,19 @@ function loadInstFile (file, instrumentations) {
6161}
6262
6363function removeVersions ( instrumentations = [ ] , external ) {
64- instrumentations . forEach ( ( instrumentation , index ) => {
64+ return instrumentations . filter ( instrumentation => {
65+ let keep = true
6566 instrumentation . versions . forEach ( instVersion => {
66- external . versions . forEach ( externalVersion => {
67- if ( semver . intersects ( instVersion , externalVersion ) ) {
68- delete instrumentations [ index ]
69- }
67+ external . versions . forEach ( ( extVersion ) => {
68+ if ( semver . intersects ( instVersion , extVersion ) ) keep = false
7069 } )
7170 } )
71+ return keep
7272 } )
7373}
7474
7575function withVersions ( plugin , modules , range , cb ) {
76- const instrumentations = typeof plugin === 'string' ? loadInst ( plugin ) : [ ] . concat ( plugin )
76+ let instrumentations = typeof plugin === 'string' ? loadInst ( plugin ) : [ ] . concat ( plugin )
7777 const names = instrumentations . map ( instrumentation => instrumentation . name )
7878
7979 modules = [ ] . concat ( modules )
@@ -97,7 +97,7 @@ function withVersions (plugin, modules, range, cb) {
9797 instrumentations . push ( external )
9898 } else {
9999 // remove all versions with that don't satisfy node version based on externals
100- removeVersions ( instrumentations , external )
100+ instrumentations = removeVersions ( instrumentations , external )
101101 }
102102 } )
103103 }
@@ -112,13 +112,13 @@ function withVersions (plugin, modules, range, cb) {
112112 const testVersions = new Map ( )
113113
114114 instrumentations
115- . filter ( Boolean )
116115 . filter ( instrumentation => instrumentation . name === moduleName )
117116 . forEach ( instrumentation => {
118117 instrumentation . versions
119118 . forEach ( version => {
120119 const min = semver . coerce ( version ) . version
121120 const max = require ( `../../../../versions/${ moduleName } @${ version } ` ) . version ( )
121+ // temporary work-around for issues with testing multiple versions within a range
122122 if ( ! instrumentation . ignoreMinVersion ) testVersions . set ( min , { range : version , test : min } )
123123 testVersions . set ( max , { range : version , test : version } )
124124 } )
0 commit comments