diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a7c6a24..51cf6924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ PLACEHOLDER for the next version: ## **WORK IN PROGRESS** --> +## **WORK IN PROGRESS** +* (@Apollon77/@copilot) Logs npm and installation errors to console for easier debugging + ## 5.1.1 (2025-08-31) * (@Apollon77) Downgrades chai-as-promised type dependency to same major as main dependency diff --git a/build/tests/integration/lib/adapterSetup.js b/build/tests/integration/lib/adapterSetup.js index 0744efdd..26b51e50 100644 --- a/build/tests/integration/lib/adapterSetup.js +++ b/build/tests/integration/lib/adapterSetup.js @@ -75,9 +75,13 @@ class AdapterSetup { // Therefore pack it into a tarball and put it in the test dir for installation const packResult = await (0, executeCommand_1.executeCommand)('npm', ['pack', '--loglevel', 'silent'], { stdout: 'pipe', + stderr: 'pipe', }); if (packResult.exitCode !== 0 || typeof packResult.stdout !== 'string') { - throw new Error(`Packing the adapter tarball failed!`); + const errorMessage = packResult.stderr + ? `Packing the adapter tarball failed!\nstderr: ${packResult.stderr}` + : `Packing the adapter tarball failed!`; + throw new Error(errorMessage); } // The last non-empty line of `npm pack`s STDOUT contains the tarball path const stdoutLines = packResult.stdout.trim().split(/[\r\n]+/); @@ -92,6 +96,7 @@ class AdapterSetup { debug('Removing the adapter from package-lock.json'); await (0, executeCommand_1.executeCommand)('npm', ['uninstall', this.adapterFullName, '--package-lock-only', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); // Complete the package.json, so npm can do it's magic debug('Saving the adapter in package.json'); @@ -114,6 +119,7 @@ class AdapterSetup { // Defer to npm to install the controller (if it wasn't already) await (0, executeCommand_1.executeCommand)('npm', ['i', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); debug(' => done!'); } @@ -126,9 +132,13 @@ class AdapterSetup { const addResult = await (0, executeCommand_1.executeCommand)('node', [`${this.appName}.js`, 'add', this.adapterName, '--enabled', 'false'], { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }); if (addResult.exitCode !== 0) { - throw new Error(`Adding the adapter instance failed!`); + const errorMessage = addResult.stderr + ? `Adding the adapter instance failed!\nstderr: ${addResult.stderr}` + : `Adding the adapter instance failed!`; + throw new Error(errorMessage); } debug(' => done!'); } diff --git a/build/tests/integration/lib/controllerSetup.js b/build/tests/integration/lib/controllerSetup.js index 005ea945..c9aa08ce 100644 --- a/build/tests/integration/lib/controllerSetup.js +++ b/build/tests/integration/lib/controllerSetup.js @@ -102,6 +102,7 @@ class ControllerSetup { debug('(Re-)installing JS Controller...'); await (0, executeCommand_1.executeCommand)('npm', ['i', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); // Prepare/clean the databases and config if (wasJsControllerInstalled) { @@ -182,13 +183,18 @@ class ControllerSetup { await (0, executeCommand_1.executeCommand)('node', [`${this.appName}.js`, 'stop'], { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }); const setupResult = await (0, executeCommand_1.executeCommand)('node', [`${this.appName}.js`, 'setup', 'first', '--console'], { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }); if (setupResult.exitCode !== 0) { - throw new Error(`${this.appName} setup first failed!`); + const errorMessage = setupResult.stderr + ? `${this.appName} setup first failed!\nstderr: ${setupResult.stderr}` + : `${this.appName} setup first failed!`; + throw new Error(errorMessage); } debug(' => done!'); } diff --git a/src/tests/integration/lib/adapterSetup.ts b/src/tests/integration/lib/adapterSetup.ts index 86cb2d76..1d1b2261 100644 --- a/src/tests/integration/lib/adapterSetup.ts +++ b/src/tests/integration/lib/adapterSetup.ts @@ -50,9 +50,13 @@ export class AdapterSetup { // Therefore pack it into a tarball and put it in the test dir for installation const packResult = await executeCommand('npm', ['pack', '--loglevel', 'silent'], { stdout: 'pipe', + stderr: 'pipe', }); if (packResult.exitCode !== 0 || typeof packResult.stdout !== 'string') { - throw new Error(`Packing the adapter tarball failed!`); + const errorMessage = packResult.stderr + ? `Packing the adapter tarball failed!\nstderr: ${packResult.stderr}` + : `Packing the adapter tarball failed!`; + throw new Error(errorMessage); } // The last non-empty line of `npm pack`s STDOUT contains the tarball path @@ -69,6 +73,7 @@ export class AdapterSetup { debug('Removing the adapter from package-lock.json'); await executeCommand('npm', ['uninstall', this.adapterFullName, '--package-lock-only', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); // Complete the package.json, so npm can do it's magic @@ -94,6 +99,7 @@ export class AdapterSetup { // Defer to npm to install the controller (if it wasn't already) await executeCommand('npm', ['i', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); debug(' => done!'); @@ -112,10 +118,14 @@ export class AdapterSetup { { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }, ); if (addResult.exitCode !== 0) { - throw new Error(`Adding the adapter instance failed!`); + const errorMessage = addResult.stderr + ? `Adding the adapter instance failed!\nstderr: ${addResult.stderr}` + : `Adding the adapter instance failed!`; + throw new Error(errorMessage); } debug(' => done!'); } diff --git a/src/tests/integration/lib/controllerSetup.ts b/src/tests/integration/lib/controllerSetup.ts index 0848faba..94c2fa67 100644 --- a/src/tests/integration/lib/controllerSetup.ts +++ b/src/tests/integration/lib/controllerSetup.ts @@ -80,6 +80,7 @@ export class ControllerSetup { debug('(Re-)installing JS Controller...'); await executeCommand('npm', ['i', '--omit=dev'], { cwd: this.testDir, + stderr: 'pipe', }); // Prepare/clean the databases and config if (wasJsControllerInstalled) { @@ -167,14 +168,19 @@ export class ControllerSetup { await executeCommand('node', [`${this.appName}.js`, 'stop'], { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }); const setupResult = await executeCommand('node', [`${this.appName}.js`, 'setup', 'first', '--console'], { cwd: this.testControllerDir, stdout: 'ignore', + stderr: 'pipe', }); if (setupResult.exitCode !== 0) { - throw new Error(`${this.appName} setup first failed!`); + const errorMessage = setupResult.stderr + ? `${this.appName} setup first failed!\nstderr: ${setupResult.stderr}` + : `${this.appName} setup first failed!`; + throw new Error(errorMessage); } debug(' => done!'); }