1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-22 11:42:46 +01:00
immich/e2e/src/setup/docker-compose.ts
Jason Rasmussen 25a380d023
feat(server): userinfo signing (#10756)
* feat(server): userinfo signing

* chore: e2e tests
2024-07-11 07:55:00 -04:00

35 lines
918 B
TypeScript

import { exec, spawn } from 'node:child_process';
import { setTimeout } from 'node:timers';
const setup = async () => {
let _resolve: () => unknown;
let _reject: (error: Error) => unknown;
const ready = new Promise<void>((resolve, reject) => {
_resolve = resolve;
_reject = reject;
});
const timeout = setTimeout(() => _reject(new Error('Timeout starting e2e environment')), 60_000);
const child = spawn('docker', ['compose', 'up'], { stdio: 'pipe' });
child.stdout.on('data', (data) => {
const input = data.toString();
console.log(input);
if (input.includes('Immich Microservices is running')) {
_resolve();
}
});
child.stderr.on('data', (data) => console.log(data.toString()));
await ready;
clearTimeout(timeout);
return async () => {
await new Promise<void>((resolve) => exec('docker compose down', () => resolve()));
};
};
export default setup;