refactor: cli e2e (#7211)

This commit is contained in:
Jason Rasmussen
2024-02-19 17:25:57 -05:00
committed by GitHub
parent 870d517ce3
commit 947bcf2d68
26 changed files with 442 additions and 500 deletions
+26
View File
@@ -0,0 +1,26 @@
import { spawn, exec } from 'child_process';
export default async () => {
let _resolve: () => unknown;
const promise = new Promise<void>((resolve) => (_resolve = resolve));
const child = spawn('docker', ['compose', 'up'], { stdio: 'pipe' });
child.stdout.on('data', (data) => {
const input = data.toString();
console.log(input);
if (input.includes('Immich Server is listening')) {
_resolve();
}
});
child.stderr.on('data', (data) => console.log(data.toString()));
await promise;
return async () => {
await new Promise<void>((resolve) =>
exec('docker compose down', () => resolve())
);
};
};