export const isMainThread = true ; type Listener = ( ... args : any [ ] ) => void ; interface Listeners { message : Listener [ ] ; error : Listener [ ] ; exit : Listener [ ] ; } const listeners = { message : [ ] , error : [ ] , exit : [ ] , } ; export const Emitter = { emit ( event , data ) { listeners [ event ] . forEach ( listener => listener ( data ) ) ; } , clear ( ) { listeners . message . splice ( 0 ) ; listeners . error . splice ( 0 ) ; listeners . exit . splice ( 0 ) ; } , } ; export class Worker { on ( event , listener ) { listeners [ event ] . push ( listener ) ; } } export const parentPort = { postMessage : jest . fn ( ) } ; export const workerData = { repository : 'mock-repository' } ;