@@ -9,7 +9,8 @@ import dedent from '@libs/StringUtils/dedent';
99import generateTranslations , { GENERATED_FILE_PREFIX } from '@scripts/generateTranslations' ;
1010import Translator from '@scripts/utils/Translator/Translator' ;
1111
12- let mockExit : jest . SpyInstance ;
12+ let processExitSpy : jest . SpyInstance ;
13+ let consoleErrorSpy : jest . SpyInstance ;
1314
1415// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
1516let mockEn : any = jest . requireActual ( '@src/languages/en' ) ;
@@ -33,7 +34,8 @@ describe('generateTranslations', () => {
3334 const ORIGINAL_ARGV = process . argv ;
3435
3536 beforeEach ( ( ) => {
36- mockExit = jest . spyOn ( process , 'exit' ) . mockImplementation ( ( ) => undefined as never ) ;
37+ processExitSpy = jest . spyOn ( process , 'exit' ) . mockImplementation ( ( ) => undefined as never ) ;
38+ consoleErrorSpy = jest . spyOn ( console , 'error' ) ;
3739
3840 tempDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'translations-test-' ) ) ;
3941 LANGUAGES_DIR = path . join ( tempDir , 'src/languages' ) ;
@@ -730,8 +732,9 @@ describe('generateTranslations', () => {
730732 process . argv = [ 'ts-node' , 'generateTranslations.ts' , '--dry-run' , '--verbose' , '--locales' , 'it' , '--paths' , 'nonexistent.path' ] ;
731733
732734 // Expect the script to throw an error during CLI parsing
733- await expect ( generateTranslations ( ) ) . rejects . toThrow ( 'Translation path not found: nonexistent.path' ) ;
734- expect ( mockExit ) . toHaveBeenCalledWith ( 1 ) ;
735+ await generateTranslations ( ) ;
736+ expect ( consoleErrorSpy ) . toHaveBeenCalledWith ( 'Invalid value for --paths: found the following invalid paths: ["nonexistent.path"]' ) ;
737+ expect ( processExitSpy ) . toHaveBeenCalledWith ( 1 ) ;
735738 } ) ;
736739
737740 it ( 'validates paths against actual translation structure' , async ( ) => {
0 commit comments