Skip to content

Commit 79749d0

Browse files
author
d.weizhe
committed
fixup! feat(@angular/cli): add devserver_rebuild MCP tool
1 parent 4c331ae commit 79749d0

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎packages/angular/cli/src/commands/mcp/devserver.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ export class LocalDevserver implements Devserver {
192192
}
193193

194194
isBuilding() {
195-
return this.buildInProgress;
195+
// A stopped or crashed server is never building.
196+
return !!this.devserverProcess && this.buildInProgress;
196197
}
197198

198199
async requestRebuild(): Promise<RebuildStatus> {

‎packages/angular/cli/src/commands/mcp/tools/devserver/devserver_spec.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ describe('Serve Tools', () => {
175175
expect(stopResult.structuredContent.logs).toEqual(['Fatal error.']);
176176
});
177177

178+
it('should not wait for a build if the server crashed while building', async () => {
179+
await startDevserver({}, mockContext);
180+
181+
mockProcess.stdout.emit('data', '❯ Changes detected. Rebuilding...\n');
182+
mockProcess.emit('close', 1);
183+
184+
const waitResult = await waitForDevserverBuild({ timeout: 10 }, mockContext);
185+
expect(waitResult.structuredContent.status).not.toBe('timeout');
186+
});
187+
178188
it('wait should timeout if build takes too long', async () => {
179189
addProjectToWorkspace(mockContext.workspace.projects, 'timeout-app');
180190
await startDevserver({ project: 'timeout-app' }, mockContext);

0 commit comments

Comments
 (0)