Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 12 additions & 2 deletions build/tests/integration/lib/adapterSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]+/);
Expand All @@ -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');
Expand All @@ -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!');
}
Expand All @@ -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!');
}
Expand Down
8 changes: 7 additions & 1 deletion build/tests/integration/lib/controllerSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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!');
}
Expand Down
14 changes: 12 additions & 2 deletions src/tests/integration/lib/adapterSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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!');
Expand All @@ -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!');
}
Expand Down
8 changes: 7 additions & 1 deletion src/tests/integration/lib/controllerSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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!');
}
Expand Down