@@ -140,15 +140,37 @@ function validateConfig(configFile) {
140
140
// Sanity check waitForTimeout
141
141
if ( ! Object . hasOwn ( storybookConfig , 'waitForTimeout' ) ) {
142
142
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 ' ) ;
145
145
console . log ( '[smartui] If you do not wish to include waitForTimeout parameter, remove it from the config file.' ) ;
146
146
storybookConfig . waitForTimeout = 0 ;
147
147
}
148
148
149
149
return storybookConfig
150
150
}
151
151
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
+
152
174
function validateConfigBrowsers ( browsers ) {
153
175
if ( browsers . length == 0 ) {
154
176
throw new ValidationError ( 'empty browsers list.' ) ;
@@ -248,5 +270,6 @@ module.exports = {
248
270
validateConfig,
249
271
validateConfigBrowsers,
250
272
validateConfigResolutions,
251
- validateCustomViewPorts
273
+ validateCustomViewPorts,
274
+ validateTunnel,
252
275
} ;
0 commit comments