@@ -9,8 +9,13 @@ import { IndexOptions, SnapshotOptions, mainCommand } from './MainCommand';
99import { sendStatus , setQuiet , setShowProgressRateLimit } from './status' ;
1010import { Indexer } from './indexer' ;
1111import { exit } from 'process' ;
12+ import { TestFailure , TestError , ValidationResults } from './test-runner' ;
1213
13- function indexAction ( options : IndexOptions ) : void {
14+
15+
16+
17+
18+ export function indexAction ( options : IndexOptions ) : void {
1419 setQuiet ( options . quiet ) ;
1520 if ( options . showProgressRateLimit !== undefined ) {
1621 setShowProgressRateLimit ( options . showProgressRateLimit ) ;
@@ -59,21 +64,32 @@ function indexAction(options: IndexOptions): void {
5964 process . chdir ( originalWorkdir ) ;
6065}
6166
67+
68+
69+
70+
71+
72+
73+
74+
75+ // Simplified snapshot action - processes tests without orchestration
6276function snapshotAction ( snapshotRoot : string , options : SnapshotOptions ) : void {
63- const subdir : string = options . only ;
6477 const inputDirectory = path . resolve ( join ( snapshotRoot , 'input' ) ) ;
6578 const outputDirectory = path . resolve ( join ( snapshotRoot , 'output' ) ) ;
66-
79+
80+ // Get all test directories
6781 let snapshotDirectories = fs . readdirSync ( inputDirectory ) ;
68- if ( subdir ) {
69- console . assert ( snapshotDirectories . find ( ( val ) => val === subdir ) !== undefined ) ;
70- snapshotDirectories = [ subdir ] ;
82+
83+ // Handle --only flag for single test processing
84+ if ( options . only ) {
85+ console . assert ( snapshotDirectories . find ( ( val ) => val === options . only ) !== undefined ) ;
86+ snapshotDirectories = [ options . only ] ;
7187 }
72-
88+
89+ // For each test directory, run the original simple processing
7390 for ( const snapshotDir of snapshotDirectories ) {
7491 let projectRoot = join ( inputDirectory , snapshotDir ) ;
7592 console . assert ( fs . lstatSync ( projectRoot ) . isDirectory ( ) ) ;
76- console . log ( `Output path = ${ options . output } ` ) ;
7793
7894 indexAction ( {
7995 projectName : options . projectName ,
@@ -91,6 +107,7 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
91107
92108 const scipIndexPath = path . join ( projectRoot , options . output ) ;
93109 const scipIndex = scip . Index . deserializeBinary ( fs . readFileSync ( scipIndexPath ) ) ;
110+
94111 for ( const doc of scipIndex . documents ) {
95112 if ( doc . relative_path . startsWith ( '..' ) ) {
96113 continue ;
@@ -103,7 +120,10 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
103120 const outputPath = path . resolve ( outputDirectory , snapshotDir , relativeToInputDirectory ) ;
104121
105122 if ( options . check ) {
106- diffSnapshot ( outputPath , obtained ) ;
123+ const diffResult = diffSnapshot ( outputPath , obtained ) ;
124+ if ( diffResult === 'different' ) {
125+ exit ( 1 ) ;
126+ }
107127 } else {
108128 writeSnapshot ( outputPath , obtained ) ;
109129 }
0 commit comments