@@ -140,15 +140,37 @@ function validateConfig(configFile) {
140140 // Sanity check waitForTimeout
141141 if ( ! Object . hasOwn ( storybookConfig , 'waitForTimeout' ) ) {
142142 storybookConfig . waitForTimeout = 0 ;
143- } else if ( storybookConfig . waitForTimeout <= 0 || storybookConfig . waitForTimeout > 30000 ) {
144- console . log ( '[smartui] Warning: Invalid config, value of waitForTimeout must be > 0 and <= 30000 ' ) ;
143+ } else if ( storybookConfig . waitForTimeout <= 0 || storybookConfig . waitForTimeout > 300000 ) {
144+ console . log ( '[smartui] Warning: Invalid config, value of waitForTimeout must be > 0 and <= 300000 ' ) ;
145145 console . log ( '[smartui] If you do not wish to include waitForTimeout parameter, remove it from the config file.' ) ;
146146 storybookConfig . waitForTimeout = 0 ;
147147 }
148148
149149 return storybookConfig
150150}
151151
152+ function validateTunnel ( configFile ) {
153+ // Verify config file exists
154+ if ( ! fs . existsSync ( configFile ) ) {
155+ console . log ( `[smartui] Error: Config file ${ configFile } not found.` ) ;
156+ process . exit ( constants . ERROR_CATCHALL ) ;
157+ }
158+
159+ let tunnelConfig ;
160+ try {
161+ let config = JSON . parse ( fs . readFileSync ( configFile ) ) ;
162+ tunnelConfig = config . tunnel || { } ;
163+ if ( tunnelConfig && tunnelConfig . type != "manual" ) {
164+ throw new ValidationError ( 'Invalid tunnel type. Accepted type is `manual` only' ) ;
165+ }
166+ } catch ( error ) {
167+ console . log ( '[smartui] Error: ' , error . message ) ;
168+ process . exit ( constants . ERROR_CATCHALL ) ;
169+ }
170+
171+ return tunnelConfig
172+ }
173+
152174function validateConfigBrowsers ( browsers ) {
153175 if ( browsers . length == 0 ) {
154176 throw new ValidationError ( 'empty browsers list.' ) ;
@@ -248,5 +270,6 @@ module.exports = {
248270 validateConfig,
249271 validateConfigBrowsers,
250272 validateConfigResolutions,
251- validateCustomViewPorts
273+ validateCustomViewPorts,
274+ validateTunnel,
252275} ;
0 commit comments