perf: speed up slow git tests from ~18s to ~5.5s

- branch-manager: beforeEach→beforeAll (all 12 tests are read-only)
- worktree manager: clone template repo per test instead of full init
- signal-manager: reduce setTimeout delay from 100ms to 30ms
This commit is contained in:
Lukas May
2026-03-07 01:07:43 +01:00
parent 4a657d6b96
commit 57784576e4
3 changed files with 28 additions and 10 deletions

View File

@@ -5,7 +5,7 @@
* a project's default branch.
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { describe, it, expect, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
@@ -133,14 +133,14 @@ describe('SimpleGitBranchManager', () => {
let cleanup: () => Promise<void>;
let branchManager: SimpleGitBranchManager;
beforeEach(async () => {
beforeAll(async () => {
const setup = await createTestRepoWithRemote();
clonePath = setup.clonePath;
cleanup = setup.cleanup;
branchManager = new SimpleGitBranchManager();
});
afterEach(async () => {
afterAll(async () => {
await cleanup();
});
@@ -177,14 +177,14 @@ describe('SimpleGitBranchManager - diffBranchesStat and diffFileSingle', () => {
let cleanup: () => Promise<void>;
let branchManager: SimpleGitBranchManager;
beforeEach(async () => {
beforeAll(async () => {
const setup = await createTestRepoForDiff();
clonePath = setup.clonePath;
cleanup = setup.cleanup;
branchManager = new SimpleGitBranchManager();
});
afterEach(async () => {
afterAll(async () => {
await cleanup();
});