github-issue-201-completetask-completed-tasks-yaml (#202)
* fix: stable release時にnext dist-tagを自動同期 * takt: github-issue-201-completetask-completed-tasks-yaml
This commit is contained in:
parent
7e15691ba2
commit
6b207e0c74
@ -180,7 +180,7 @@ describe('TaskRunner (tasks.yaml)', () => {
|
|||||||
expect(() => runner.listTasks()).toThrow(/ENOENT|no such file/i);
|
expect(() => runner.listTasks()).toThrow(/ENOENT|no such file/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark claimed task as completed', () => {
|
it('should remove completed task record from tasks.yaml', () => {
|
||||||
runner.addTask('Task A');
|
runner.addTask('Task A');
|
||||||
const task = runner.claimNextTasks(1)[0]!;
|
const task = runner.claimNextTasks(1)[0]!;
|
||||||
|
|
||||||
@ -194,7 +194,27 @@ describe('TaskRunner (tasks.yaml)', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const file = loadTasksFile(testDir);
|
const file = loadTasksFile(testDir);
|
||||||
expect(file.tasks[0]?.status).toBe('completed');
|
expect(file.tasks).toHaveLength(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remove only the completed task when multiple tasks exist', () => {
|
||||||
|
runner.addTask('Task A');
|
||||||
|
runner.addTask('Task B');
|
||||||
|
const task = runner.claimNextTasks(1)[0]!;
|
||||||
|
|
||||||
|
runner.completeTask({
|
||||||
|
task,
|
||||||
|
success: true,
|
||||||
|
response: 'Done',
|
||||||
|
executionLog: [],
|
||||||
|
startedAt: new Date().toISOString(),
|
||||||
|
completedAt: new Date().toISOString(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const file = loadTasksFile(testDir);
|
||||||
|
expect(file.tasks).toHaveLength(1);
|
||||||
|
expect(file.tasks[0]?.name).toContain('task-b');
|
||||||
|
expect(file.tasks[0]?.status).toBe('pending');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should mark claimed task as failed with failure detail', () => {
|
it('should mark claimed task as failed with failure detail', () => {
|
||||||
|
|||||||
@ -119,17 +119,9 @@ export class TaskRunner {
|
|||||||
throw new Error(`Task not found: ${result.task.name}`);
|
throw new Error(`Task not found: ${result.task.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const target = current.tasks[index]!;
|
return {
|
||||||
const updated: TaskRecord = {
|
tasks: current.tasks.filter((_, i) => i !== index),
|
||||||
...target,
|
|
||||||
status: 'completed',
|
|
||||||
completed_at: result.completedAt,
|
|
||||||
owner_pid: null,
|
|
||||||
failure: undefined,
|
|
||||||
};
|
};
|
||||||
const tasks = [...current.tasks];
|
|
||||||
tasks[index] = updated;
|
|
||||||
return { tasks };
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.tasksFile;
|
return this.tasksFile;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user