mirror of
https://github.com/immich-app/immich.git
synced 2025-01-22 11:42:46 +01:00
25a380d023
* feat(server): userinfo signing * chore: e2e tests
35 lines
918 B
TypeScript
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;
|