@@ -27,6 +27,18 @@ import * as fsUtils from './fs';
2727const deepResolve = require ( `super-resolve` ) ;
2828const staticServer = serveStatic ( npath . fromPortablePath ( require ( `pkg-tests-fixtures` ) ) ) ;
2929
30+ const TEST_MAJOR = process . env . TEST_MAJOR
31+ ? parseInt ( process . env . TEST_MAJOR , 10 )
32+ : null ;
33+
34+ function isAtLeastMajor ( major : number ) {
35+ return TEST_MAJOR !== null && TEST_MAJOR >= major ;
36+ }
37+
38+ export const FEATURE_CHECKS = {
39+ prologConstraints : ! isAtLeastMajor ( 5 ) ,
40+ } as const ;
41+
3042// Testing things inside a big-endian container takes forever
3143export const TEST_TIMEOUT = os . endianness ( ) === `BE`
3244 ? 300000
@@ -1075,11 +1087,18 @@ export const generatePkgDriver = ({
10751087 return withConfig ( { } ) ;
10761088} ;
10771089
1078- export const testIf = ( condition : ( ) => boolean , name : string ,
1079- execute ?: jest . ProvidesCallback | undefined , timeout ?: number | undefined ) => {
1080- if ( condition ( ) ) {
1081- test ( name , execute , timeout ) ;
1082- }
1090+ export const testIf = ( condition : ( ( ) => boolean ) | keyof typeof FEATURE_CHECKS | boolean , name : string , execute ?: jest . ProvidesCallback | undefined , timeout ?: number | undefined ) => {
1091+ const isConditionMet = typeof condition === `function`
1092+ ? condition ( )
1093+ : typeof condition === `boolean`
1094+ ? condition
1095+ : FEATURE_CHECKS [ condition ] ;
1096+
1097+ const testFn = isConditionMet
1098+ ? test
1099+ : test . skip ;
1100+
1101+ testFn ( name , execute , timeout ) ;
10831102} ;
10841103
10851104let httpsCertificates : {
0 commit comments