refactor(ngcc): add message text to task outcomes (#36083)

This sets up the task execution to be able to report failed compiles

PR Close #36083
This commit is contained in:
Pete Bacon Darwin
2020-03-14 13:20:51 +00:00
committed by Andrew Kushnir
parent d50881a86e
commit 712f2642d5
5 changed files with 22 additions and 6 deletions

View File

@ -54,15 +54,26 @@ describe('ClusterWorker', () => {
expect(createCompileFnSpy).toHaveBeenCalledWith(jasmine.any(Function));
});
it('should set up `compileFn()` to send a `task-completed` message to master', () => {
it('should set up `compileFn()` to send `task-completed` messages to master', () => {
new ClusterWorker(mockLogger, createCompileFnSpy);
const onTaskCompleted: TaskCompletedCallback = createCompileFnSpy.calls.argsFor(0)[0];
onTaskCompleted(null as any, TaskProcessingOutcome.Processed);
onTaskCompleted(null as any, TaskProcessingOutcome.Processed, null);
expect(processSendSpy).toHaveBeenCalledTimes(1);
expect(processSendSpy).toHaveBeenCalledWith({
type: 'task-completed',
outcome: TaskProcessingOutcome.Processed,
message: null
});
processSendSpy.calls.reset();
onTaskCompleted(null as any, TaskProcessingOutcome.Failed, 'error message');
expect(processSendSpy).toHaveBeenCalledTimes(1);
expect(processSendSpy).toHaveBeenCalledWith({
type: 'task-completed',
outcome: TaskProcessingOutcome.Failed,
message: 'error message',
});
});
});