This repository was archived by the owner on Jan 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
test-12-compression-node-opcua Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,13 +7,7 @@ const path = require('path');
77const assert = require ( 'assert' ) ;
88const utils = require ( '../utils.js' ) ;
99
10- // ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
11- const MAJOR_VERSION = parseInt ( process . version . match ( / v ( [ 0 - 9 ] + ) / ) [ 1 ] , 10 ) ;
12- if ( MAJOR_VERSION < 12 ) {
13- console . log (
14- 'skiping test as it requires nodejs >= 12 and got' ,
15- MAJOR_VERSION
16- ) ;
10+ if ( utils . shouldSkipPnpm ( ) ) {
1711 return ;
1812}
1913
Original file line number Diff line number Diff line change @@ -7,13 +7,7 @@ const path = require('path');
77const assert = require ( 'assert' ) ;
88const utils = require ( '../utils.js' ) ;
99
10- // ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
11- const MAJOR_VERSION = parseInt ( process . version . match ( / v ( [ 0 - 9 ] + ) / ) [ 1 ] , 10 ) ;
12- if ( MAJOR_VERSION < 12 ) {
13- console . log (
14- 'skiping test as it requires nodejs >= 12 and got' ,
15- MAJOR_VERSION
16- ) ;
10+ if ( utils . shouldSkipPnpm ( ) ) {
1711 return ;
1812}
1913
Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ const utils = require('../utils.js');
1616assert ( ! module . parent ) ;
1717assert ( __dirname === process . cwd ( ) ) ;
1818
19- // ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
20- const MAJOR_VERSION = parseInt ( process . version . match ( / v ( [ 0 - 9 ] + ) / ) [ 1 ] , 10 ) ;
21- if ( MAJOR_VERSION < 12 ) {
19+ if ( utils . shouldSkipPnpm ( ) ) {
2220 return ;
2321}
2422
Original file line number Diff line number Diff line change @@ -165,3 +165,22 @@ module.exports.filesAfter = function (b, n) {
165165 module . exports . vacuum . sync ( ni ) ;
166166 }
167167} ;
168+
169+ module . exports . shouldSkipPnpm = function ( ) {
170+ const REQUIRED_MAJOR_VERSION = 14 ;
171+ const REQUIRED_MINOR_VERSION = 19 ;
172+
173+ const MAJOR_VERSION = parseInt ( process . version . match ( / v ( [ 0 - 9 ] + ) / ) [ 1 ] , 10 ) ;
174+ const MINOR_VERSION = parseInt ( process . version . match ( / v [ 0 - 9 ] + \. ( [ 0 - 9 ] + ) / ) [ 1 ] , 10 ) ;
175+
176+ const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION
177+ const isDisallowedMinor = MAJOR_VERSION === REQUIRED_MAJOR_VERSION && MINOR_VERSION < REQUIRED_MINOR_VERSION ;
178+ if ( isDisallowedMajor || isDisallowedMinor ) {
179+ const need = `${ REQUIRED_MAJOR_VERSION } .${ REQUIRED_MINOR_VERSION } ` ;
180+ const got = `${ MAJOR_VERSION } .${ MINOR_VERSION } ` ;
181+ console . log ( `skiping test as it requires nodejs >= ${ need } and got ${ got } ` ) ;
182+ return true ;
183+ }
184+
185+ return false ;
186+ }
You can’t perform that action at this time.
0 commit comments