@@ -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,10 +182,13 @@ export async function checkConformance(options: {
179182 }
180183
181184 const outputDir = mkdtempSync ( join ( tmpdir ( ) , 'tier-check-server-' ) ) ;
185+ const specVersionArg = options . specVersion
186+ ? `--spec-version ${ options . specVersion } `
187+ : '' ;
182188
183189 try {
184190 execSync (
185- `node dist/index.js server --url ${ options . serverUrl } -o ${ outputDir } ` ,
191+ `node dist/index.js server --url ${ options . serverUrl } -o ${ outputDir } ${ specVersionArg } ` ,
186192 {
187193 cwd : process . cwd ( ) ,
188194 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
@@ -193,9 +199,16 @@ export async function checkConformance(options: {
193199 // Non-zero exit is expected when tests fail — results are still in outputDir
194200 }
195201
202+ const activeScenarios = new Set ( listActiveClientScenarios ( ) ) ;
203+ const expectedScenarios = options . specVersion
204+ ? listClientScenariosForSpec ( options . specVersion ) . filter ( ( s ) =>
205+ activeScenarios . has ( s )
206+ )
207+ : [ ...activeScenarios ] ;
208+
196209 return reconcileWithExpected (
197210 parseOutputDir ( outputDir ) ,
198- listActiveClientScenarios ( ) ,
211+ expectedScenarios ,
199212 'server'
200213 ) ;
201214}
@@ -206,6 +219,7 @@ export async function checkConformance(options: {
206219export async function checkClientConformance ( options : {
207220 clientCmd ?: string ;
208221 skip ?: boolean ;
222+ specVersion ?: SpecVersion ;
209223} ) : Promise < ConformanceResult > {
210224 if ( options . skip || ! options . clientCmd ) {
211225 return {
@@ -219,10 +233,13 @@ export async function checkClientConformance(options: {
219233 }
220234
221235 const outputDir = mkdtempSync ( join ( tmpdir ( ) , 'tier-check-client-' ) ) ;
236+ const specVersionArg = options . specVersion
237+ ? `--spec-version ${ options . specVersion } `
238+ : '' ;
222239
223240 try {
224241 execSync (
225- `node dist/index.js client --command '${ options . clientCmd } ' --suite all -o ${ outputDir } ` ,
242+ `node dist/index.js client --command '${ options . clientCmd } ' --suite all -o ${ outputDir } ${ specVersionArg } ` ,
226243 {
227244 cwd : process . cwd ( ) ,
228245 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
@@ -233,5 +250,9 @@ export async function checkClientConformance(options: {
233250 // Non-zero exit is expected when tests fail — results are still in outputDir
234251 }
235252
236- return reconcileWithExpected ( parseOutputDir ( outputDir ) , listScenarios ( ) ) ;
253+ const expectedScenarios = options . specVersion
254+ ? listScenariosForSpec ( options . specVersion )
255+ : listScenarios ( ) ;
256+
257+ return reconcileWithExpected ( parseOutputDir ( outputDir ) , expectedScenarios ) ;
237258}
0 commit comments