@@ -53,35 +53,37 @@ export const registerStartE2edRunEvent = async (): Promise<void> => {
5353 const startInfo = getStartInfo ( { configCompileTimeWithUnits} ) ;
5454
5555 try {
56- await runBeforePackFunctions ( startInfo ) ;
57- } catch ( cause ) {
58- setGlobalExitCode ( ExitCode . HasErrorsInDoBeforePackFunctions ) ;
59-
60- throw new E2edError ( 'Caught an error on running "before pack" functions' , { cause} ) ;
61- }
56+ try {
57+ await runBeforePackFunctions ( startInfo ) ;
58+ } catch ( cause ) {
59+ setGlobalExitCode ( ExitCode . HasErrorsInDoBeforePackFunctions ) ;
6260
63- const fullPackConfig = getFullPackConfig ( ) ;
61+ throw new E2edError ( 'Caught an error on running "before pack" functions' , { cause} ) ;
62+ }
6463
65- updateConfig ( fullPackConfig , startInfo ) ;
64+ const fullPackConfig = getFullPackConfig ( ) ;
6665
67- if ( errorSettingDotEnv !== undefined ) {
68- generalLog ( 'Caught an error on setting environment variables from `variables.env` file' , {
69- errorSettingDotEnv,
70- } ) ;
71- }
66+ updateConfig ( fullPackConfig , startInfo ) ;
7267
73- if ( compileErrors . length !== 0 ) {
74- const pathToPack = getPathToPack ( ) ;
68+ if ( errorSettingDotEnv !== undefined ) {
69+ generalLog ( 'Caught an error on setting environment variables from `variables.env` file' , {
70+ errorSettingDotEnv,
71+ } ) ;
72+ }
7573
76- generalLog ( `Caught errors on compiling pack ${ pathToPack } ` , { compileErrors } ) ;
77- }
74+ if ( compileErrors . length !== 0 ) {
75+ const pathToPack = getPathToPack ( ) ;
7876
79- const { e2ed, runEnvironment} = startInfo ;
80- const isLocalRun = runEnvironment !== RunEnvironment . Docker ;
81- const startMessage = `Run tests ${ isLocalRun ? 'local' : 'in docker' } with e2ed@${ e2ed . version } ` ;
77+ generalLog ( `Caught errors on compiling pack ${ pathToPack } ` , { compileErrors} ) ;
78+ }
8279
83- generalLog ( startMessage , startInfo ) ;
80+ const { e2ed, runEnvironment} = startInfo ;
81+ const isLocalRun = runEnvironment !== RunEnvironment . Docker ;
82+ const startMessage = `Run tests ${ isLocalRun ? 'local' : 'in docker' } with e2ed@${ e2ed . version } ` ;
8483
85- await writeStartInfo ( startInfo ) ;
86- await writeLogsToFile ( ) ;
84+ generalLog ( startMessage , startInfo ) ;
85+ } finally {
86+ await writeStartInfo ( startInfo ) ;
87+ await writeLogsToFile ( ) ;
88+ }
8789} ;
0 commit comments