Skip to content

Commit

Permalink
simplify code now workerId is in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Nov 14, 2022
1 parent 79733ea commit ee845f4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/runtime/parallel/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,11 @@ export default class Worker {
this.sendMessage = sendMessage
this.eventBroadcaster = new EventEmitter()
this.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {
const jsonEnvelope = { ...envelope }

// assign `workerId` property only for the `testCaseStarted` message
if (envelope.testCaseStarted) {
Object.assign(jsonEnvelope.testCaseStarted, {
workerId: this.id,
})
envelope.testCaseStarted.workerId = this.id
}

this.sendMessage({ jsonEnvelope: JSON.stringify(jsonEnvelope) })
this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) })
})
}

Expand Down

0 comments on commit ee845f4

Please sign in to comment.