@@ -6,6 +6,8 @@ import { ConformanceResult } from '../types';
66import {
77 listScenarios ,
88 listActiveClientScenarios ,
9+ listScenariosForSpec ,
10+ listClientScenariosForSpec ,
911 getScenarioSpecVersions
1012} from '../../scenarios' ;
1113import { ConformanceCheck , SpecVersion } from '../../types' ;
@@ -166,6 +168,7 @@ function reconcileWithExpected(
166168export async function checkConformance ( options : {
167169 serverUrl ?: string ;
168170 skip ?: boolean ;
171+ specVersion ?: SpecVersion ;
169172} ) : Promise < ConformanceResult > {
170173 if ( options . skip || ! options . serverUrl ) {
171174 return {
@@ -179,23 +182,37 @@ export async function checkConformance(options: {
179182 }
180183
181184 const outputDir = mkdtempSync ( join ( tmpdir ( ) , 'tier-check-server-' ) ) ;
185+ const args = [
186+ process . argv [ 1 ] ,
187+ 'server' ,
188+ '--url' ,
189+ options . serverUrl ,
190+ '-o' ,
191+ outputDir
192+ ] ;
193+ if ( options . specVersion ) {
194+ args . push ( '--spec-version' , options . specVersion ) ;
195+ }
182196
183197 try {
184- execFileSync (
185- process . execPath ,
186- [ process . argv [ 1 ] , 'server' , '--url' , options . serverUrl , '-o' , outputDir ] ,
187- {
188- stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
189- timeout : 120_000
190- }
191- ) ;
198+ execFileSync ( process . execPath , args , {
199+ stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
200+ timeout : 120_000
201+ } ) ;
192202 } catch {
193203 // Non-zero exit is expected when tests fail — results are still in outputDir
194204 }
195205
206+ const activeScenarios = new Set ( listActiveClientScenarios ( ) ) ;
207+ const expectedScenarios = options . specVersion
208+ ? listClientScenariosForSpec ( options . specVersion ) . filter ( ( s ) =>
209+ activeScenarios . has ( s )
210+ )
211+ : [ ...activeScenarios ] ;
212+
196213 return reconcileWithExpected (
197214 parseOutputDir ( outputDir ) ,
198- listActiveClientScenarios ( ) ,
215+ expectedScenarios ,
199216 'server'
200217 ) ;
201218}
@@ -206,6 +223,7 @@ export async function checkConformance(options: {
206223export async function checkClientConformance ( options : {
207224 clientCmd ?: string ;
208225 skip ?: boolean ;
226+ specVersion ?: SpecVersion ;
209227} ) : Promise < ConformanceResult > {
210228 if ( options . skip || ! options . clientCmd ) {
211229 return {
@@ -219,28 +237,32 @@ export async function checkClientConformance(options: {
219237 }
220238
221239 const outputDir = mkdtempSync ( join ( tmpdir ( ) , 'tier-check-client-' ) ) ;
240+ const args = [
241+ process . argv [ 1 ] ,
242+ 'client' ,
243+ '--command' ,
244+ options . clientCmd ,
245+ '--suite' ,
246+ 'all' ,
247+ '-o' ,
248+ outputDir
249+ ] ;
250+ if ( options . specVersion ) {
251+ args . push ( '--spec-version' , options . specVersion ) ;
252+ }
222253
223254 try {
224- execFileSync (
225- process . execPath ,
226- [
227- process . argv [ 1 ] ,
228- 'client' ,
229- '--command' ,
230- options . clientCmd ,
231- '--suite' ,
232- 'all' ,
233- '-o' ,
234- outputDir
235- ] ,
236- {
237- stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
238- timeout : 120_000
239- }
240- ) ;
255+ execFileSync ( process . execPath , args , {
256+ stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
257+ timeout : 120_000
258+ } ) ;
241259 } catch {
242260 // Non-zero exit is expected when tests fail — results are still in outputDir
243261 }
244262
245- return reconcileWithExpected ( parseOutputDir ( outputDir ) , listScenarios ( ) ) ;
263+ const expectedScenarios = options . specVersion
264+ ? listScenariosForSpec ( options . specVersion )
265+ : listScenarios ( ) ;
266+
267+ return reconcileWithExpected ( parseOutputDir ( outputDir ) , expectedScenarios ) ;
246268}
0 commit comments