@@ -18,23 +18,23 @@ describe('tools/spectral/ipa/metrics/scripts/runMetricCollection.js', () => {
1818 it ( 'should run without import/syntax errors' , ( ) => {
1919 const scriptPath = path . join ( __dirname , '../../metrics/scripts/runMetricCollection.js' ) ;
2020
21- // Run the script with Node.js
22- const result = spawnSync ( 'node' , [ scriptPath ] , {
21+ // Run the script with Node.js, providing a non-existent file path
22+ // This will cause it to fail early before doing any real work
23+ const result = spawnSync ( 'node' , [ scriptPath , '/nonexistent/path/to/spec.json' ] , {
2324 encoding : 'utf8' ,
2425 timeout : 10000 ,
2526 } ) ;
2627
27- // The script will fail because required files don 't exist in the test environment ,
28+ // The script will fail because the file doesn 't exist,
2829 // but it should NOT fail with a SyntaxError about missing exports
2930 const output = result . stdout + result . stderr ;
3031
3132 // Check that we don't have import/syntax errors
3233 expect ( output ) . not . toMatch ( / S y n t a x E r r o r .* d o e s n o t p r o v i d e a n e x p o r t n a m e d / ) ;
3334 expect ( output ) . not . toMatch ( / S y n t a x E r r o r .* U n e x p e c t e d t o k e n / ) ;
3435
35- // We expect it to fail with ENOENT for the missing collector results file
36+ // We expect it to fail due to missing files (either OAS file or collector results)
3637 // This proves the imports worked correctly
37- expect ( output ) . toMatch ( / E N O E N T . * i p a - c o l l e c t o r - r e s u l t s - c o m b i n e d \. l o g / ) ;
38+ expect ( output ) . toMatch ( / E N O E N T | C o u l d n o t f i n d / ) ;
3839 } ) ;
3940} ) ;
40-
0 commit comments