mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 00:19:42 +02:00
fix: clean up test case directories after each test instead of at end
Moves case directory cleanup from afterAll to afterEach in all test files that create cases. Previously, if the test suite was interrupted or afterAll timed out, all case directories were left behind. Now each test cleans up immediately after itself. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,16 +18,20 @@ describe('Quick Start API', () => {
|
||||
baseUrl = `http://localhost:${TEST_PORT}`;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await server.stop();
|
||||
// Cleanup created test cases
|
||||
for (const caseName of createdCases) {
|
||||
afterEach(() => {
|
||||
// Clean up cases created during this test
|
||||
while (createdCases.length > 0) {
|
||||
const caseName = createdCases.pop()!;
|
||||
const casePath = join(CASES_DIR, caseName);
|
||||
if (existsSync(casePath)) {
|
||||
rmSync(casePath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}, 30000); // Increase timeout since server.stop() kills screen sessions
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await server.stop();
|
||||
}, 30000);
|
||||
|
||||
describe('POST /api/quick-start', () => {
|
||||
it('should create default testcase and start interactive session', async () => {
|
||||
|
||||
Reference in New Issue
Block a user