@@ -39,6 +39,7 @@ function runCommand(command, args, options = {}) {
3939 proc . on ( 'close' , ( code ) => {
4040 if ( rejectedOrResolved ) return ;
4141 if ( timeoutId ) clearTimeout ( timeoutId ) ;
42+ console . log ( `Process exited with code ${ code } ` ) ;
4243 if ( code === 0 || code === 255 ) {
4344 setTimeout ( ( ) => resolve ( { stdout, stderr, code } ) , 5000 ) ;
4445 } else {
@@ -116,12 +117,12 @@ function runCommandWithTimeout(command, args, options = {}) {
116117 if ( options . verbose ) {
117118 console . log ( 'STDOUT:' , str . trim ( ) ) ;
118119 }
119-
120+
120121 // Call custom stdout handler if provided
121122 if ( options . onStdout ) {
122123 options . onStdout ( str , shutDown ) ;
123124 }
124-
125+
125126 // Default behavior: shutdown on final message
126127 if ( ! options . onStdout && options . finalMessage && str . match ( options . finalMessage ) && ! closed && ! resolvedOrRejected ) {
127128 console . log ( 'Final message detected, shutting down...' ) ;
@@ -197,8 +198,9 @@ async function createTestAdapter(configFile, targetDir) {
197198 `--replay=${ configPath } ` ,
198199 `--target=${ targetDir } ` ,
199200 '--noInstall' , // Skip npm install to speed up creation
200- '--non-interactive' // Prevent interactive prompts
201+ '--nonInteractive' // Run in non- interactive mode to fill in missing config details
201202 ] , {
203+ verbose :true ,
202204 cwd : targetDir ,
203205 timeout : 180000 , // 3 minutes
204206 env : { ...process . env , NODE_TLS_REJECT_UNAUTHORIZED : '0' } // Handle certificate issues in test environment
@@ -251,7 +253,7 @@ async function setupTestAdapter(config) {
251253
252254 // Install dependencies
253255 await installAdapterDependencies ( adapterName , adapterDir ) ;
254-
256+
255257 console . log ( `${ adapterName } test adapter prepared successfully` ) ;
256258}
257259
@@ -261,7 +263,7 @@ async function setupTestAdapter(config) {
261263async function applyTypeScriptPatches ( adapterDir ) {
262264 const mainTsPath = path . join ( adapterDir , 'src' , 'main.ts' ) ;
263265 let mainTsContent = fs . readFileSync ( mainTsPath , 'utf8' ) ;
264-
266+
265267 // Patch variable declarations for TypeScript compliance
266268 mainTsContent = mainTsContent . replace (
267269 'let result = await this.checkPasswordAsync("admin", "iobroker");' ,
@@ -275,7 +277,7 @@ async function applyTypeScriptPatches(adapterDir) {
275277 'this.log.info("check group user admin group admin: " + result);' ,
276278 'this.log.info("check group user admin group admin: " + groupResult);' ,
277279 ) ;
278-
280+
279281 fs . writeFileSync ( mainTsPath , mainTsContent , 'utf8' ) ;
280282 console . log ( `Patched ${ mainTsPath } for TypeScript compliance` ) ;
281283}
@@ -315,7 +317,7 @@ function cleanupTestAdapter(adapterName, adapterDir) {
315317function validateIoPackageJson ( adapterDir , expectedName , shouldHaveTypescript = false ) {
316318 const ioPackagePath = path . join ( adapterDir , 'io-package.json' ) ;
317319 const assert = require ( 'node:assert' ) ;
318-
320+
319321 assert . ok ( fs . existsSync ( ioPackagePath ) , 'io-package.json not found' ) ;
320322
321323 const ioPackage = JSON . parse ( fs . readFileSync ( ioPackagePath , 'utf8' ) ) ;
@@ -329,18 +331,18 @@ function validateIoPackageJson(adapterDir, expectedName, shouldHaveTypescript =
329331}
330332
331333/**
332- * Common assertions for package.json validation
334+ * Common assertions for package.json validation
333335 */
334336function validatePackageJson ( adapterDir ) {
335337 const packagePath = path . join ( adapterDir , 'package.json' ) ;
336338 const assert = require ( 'node:assert' ) ;
337-
339+
338340 assert . ok ( fs . existsSync ( packagePath ) , 'package.json not found' ) ;
339341
340342 const packageJson = JSON . parse ( fs . readFileSync ( packagePath , 'utf8' ) ) ;
341343 assert . ok ( packageJson . name , 'package.json missing name' ) ;
342344 assert . ok ( packageJson . version , 'package.json missing version' ) ;
343-
345+
344346 return packageJson ;
345347}
346348
@@ -350,7 +352,7 @@ function validatePackageJson(adapterDir) {
350352function validateTypeScriptConfig ( adapterDir ) {
351353 const tsconfigPath = path . join ( adapterDir , 'tsconfig.json' ) ;
352354 const assert = require ( 'node:assert' ) ;
353-
355+
354356 assert . ok ( fs . existsSync ( tsconfigPath ) , 'tsconfig.json not found for TypeScript adapter' ) ;
355357}
356358
@@ -462,7 +464,7 @@ function runCommandWithFileChange(command, args, options = {}) {
462464 if ( ! fileChanged && options . initialMessage && str . match ( options . initialMessage ) ) {
463465 console . log ( 'Initial message detected, triggering file change...' ) ;
464466 fileChanged = true ;
465-
467+
466468 // Wait a bit then trigger file change
467469 setTimeout ( ( ) => {
468470 if ( options . fileToChange ) {
@@ -477,13 +479,13 @@ function runCommandWithFileChange(command, args, options = {}) {
477479 }
478480 } , 5000 ) ;
479481 }
480-
482+
481483 // Detect restart and wait for it to complete
482484 if ( fileChanged && ! restartDetected && str . match ( / r e s t a r t i n g | r e s t a r t / i) ) {
483485 console . log ( 'Restart detected...' ) ;
484486 restartDetected = true ;
485487 }
486-
488+
487489 // After restart, wait for final message
488490 if ( restartDetected && options . finalMessage && str . match ( options . finalMessage ) ) {
489491 console . log ( 'Final message after restart detected, shutting down...' ) ;
0 commit comments