@@ -119,7 +119,7 @@ test('download headers (actual)', function (t) {
119
119
return t . skip ( 'Skipping acutal download of headers due to test environment configuration' )
120
120
}
121
121
122
- t . plan ( 19 )
122
+ t . plan ( 17 )
123
123
124
124
const expectedDir = path . join ( devDir , process . version . replace ( / ^ v / , '' ) )
125
125
rimraf ( expectedDir , ( err ) => {
@@ -157,20 +157,16 @@ test('download headers (actual)', function (t) {
157
157
158
158
const lines = contents . split ( '\n' )
159
159
160
- // extract the 3 version parts from the defines and check them against our env version
161
-
160
+ // extract the 3 version parts from the defines to build a valid version string and
161
+ // and check them against our current env version
162
162
const version = [ 'major' , 'minor' , 'patch' ] . reduce ( ( version , type ) => {
163
163
const re = new RegExp ( `^#define\\sNODE_${ type . toUpperCase ( ) } _VERSION` )
164
164
const line = lines . find ( ( l ) => re . test ( l ) )
165
- if ( line ) {
166
- version [ type ] = parseInt ( line . replace ( / ^ [ ^ 0 - 9 ] + ( [ 0 - 9 ] + ) .* $ / , '$1' ) , 10 )
167
- }
168
- return version
169
- } , { } )
170
-
171
- t . strictEqual ( version . major , semver . major ( process . version ) )
172
- t . strictEqual ( version . minor , semver . minor ( process . version ) )
173
- t . strictEqual ( version . patch , semver . patch ( process . version ) )
165
+ const i = line ? parseInt ( line . replace ( / ^ [ ^ 0 - 9 ] + ( [ 0 - 9 ] + ) .* $ / , '$1' ) , 10 ) : 'ERROR'
166
+ return `${ version } ${ type !== 'major' ? '.' : 'v' } ${ i } `
167
+ } , '' )
168
+
169
+ t . strictEqual ( version , process . version )
174
170
} )
175
171
} )
176
172
} )
0 commit comments