@@ -27,6 +27,18 @@ import * as fsUtils from './fs';
27
27
const deepResolve = require ( `super-resolve` ) ;
28
28
const staticServer = serveStatic ( npath . fromPortablePath ( require ( `pkg-tests-fixtures` ) ) ) ;
29
29
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
+
30
42
// Testing things inside a big-endian container takes forever
31
43
export const TEST_TIMEOUT = os . endianness ( ) === `BE`
32
44
? 300000
@@ -1075,11 +1087,18 @@ export const generatePkgDriver = ({
1075
1087
return withConfig ( { } ) ;
1076
1088
} ;
1077
1089
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 ) ;
1083
1102
} ;
1084
1103
1085
1104
let httpsCertificates : {
0 commit comments