Display Authelia server logs when tests fail.
parent
c258c25a38
commit
4adb0569ac
|
@ -42,3 +42,8 @@ server.stderr.on('data', (data) => {
|
|||
process.stderr.write(`${data}`);
|
||||
});
|
||||
server.stderr.pipe(logStream);
|
||||
|
||||
|
||||
server.on('exit', function(statusCode) {
|
||||
process.exit(statusCode);
|
||||
})
|
|
@ -54,6 +54,13 @@ mocha.stderr.on('data', (data) => {
|
|||
mocha.on('exit', function(statusCode) {
|
||||
if (statusCode != 0) {
|
||||
console.error("The tests failed... Mocha exited with status code " + statusCode);
|
||||
fs.readFile('/tmp/authelia-server.log', function(err, data) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
console.log(data.toString('utf-8'));
|
||||
});
|
||||
}
|
||||
process.exit(statusCode);
|
||||
})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
import ChildProcess from 'child_process';
|
||||
import fs from 'fs';
|
||||
|
||||
export default function WithAutheliaRunning(configPath: string, waitTimeout: number = 5000) {
|
||||
before(function() {
|
||||
|
@ -11,8 +12,17 @@ export default function WithAutheliaRunning(configPath: string, waitTimeout: num
|
|||
['serve', '--no-watch', '--config', configPath],
|
||||
{detached: true});
|
||||
|
||||
authelia.on('exit', function(status) {
|
||||
console.log('Server terminated with status ' + status);
|
||||
authelia.on('exit', function(statusCode) {
|
||||
console.log('Server terminated with status ' + statusCode);
|
||||
if (statusCode != 0) {
|
||||
fs.readFile('/tmp/authelia-server.log', function(err, data) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
console.log(data.toString('utf-8'));
|
||||
})
|
||||
}
|
||||
});
|
||||
this.authelia = authelia;
|
||||
|
||||
|
|
Loading…
Reference in New Issue