@@ -137,6 +137,10 @@ export class RstestApi {
137
137
const workerPath = path . resolve ( __dirname , 'worker.js' ) ;
138
138
const port = await getPort ( ) ;
139
139
const wsAddress = `ws://localhost:${ port } ` ;
140
+ logger . debug ( 'Spawning worker process' , {
141
+ workerPath,
142
+ wsAddress,
143
+ } ) ;
140
144
const rstestProcess = spawn ( 'node' , [ ...execArgv , workerPath ] , {
141
145
stdio : 'pipe' ,
142
146
env : {
@@ -148,19 +152,20 @@ export class RstestApi {
148
152
149
153
rstestProcess . stdout ?. on ( 'data' , ( d ) => {
150
154
const content = d . toString ( ) ;
151
- logger . debug ( '🟢 worker' , content . trimEnd ( ) ) ;
155
+ logger . debug ( 'worker stdout ' , content . trimEnd ( ) ) ;
152
156
} ) ;
153
157
154
158
rstestProcess . stderr ?. on ( 'data' , ( d ) => {
155
159
const content = d . toString ( ) ;
156
- logger . error ( '🔴 worker' , content . trimEnd ( ) ) ;
160
+ logger . error ( 'worker stderr ' , content . trimEnd ( ) ) ;
157
161
} ) ;
158
162
159
163
const server = createServer ( ) . listen ( port ) . unref ( ) ;
160
164
const wss = new WebSocketServer ( { server } ) ;
161
165
162
166
wss . once ( 'connection' , ( ws ) => {
163
167
this . ws = ws ;
168
+ logger . debug ( 'Worker connected' , { wsAddress } ) ;
164
169
const { cwd, rstestPath } = this . resolveRstestPath ( ) [ 0 ] ;
165
170
ws . send (
166
171
JSON . stringify ( {
@@ -169,11 +174,21 @@ export class RstestApi {
169
174
cwd,
170
175
} ) ,
171
176
) ;
177
+ logger . debug ( 'Sent init payload to worker' , { cwd, rstestPath } ) ;
172
178
173
179
ws . on ( 'message' , ( _data ) => {
174
180
const _message = JSON . parse ( _data . toString ( ) ) as WorkerEvent ;
175
181
if ( _message . type === 'finish' ) {
176
182
const message : WorkerEventFinish = _message ;
183
+ logger . debug ( 'Received worker completion event' , {
184
+ id : message . id ,
185
+ testResultCount : Array . isArray ( message . testResults )
186
+ ? message . testResults . length
187
+ : undefined ,
188
+ testFileResultCount : Array . isArray ( message . testFileResults )
189
+ ? message . testFileResults . length
190
+ : undefined ,
191
+ } ) ;
177
192
// Check if we have a pending promise for this test ID
178
193
const promiseObj = this . testPromises . get ( message . id ) ;
179
194
if ( promiseObj ) {
@@ -186,7 +201,9 @@ export class RstestApi {
186
201
} ) ;
187
202
} ) ;
188
203
189
- rstestProcess . on ( 'exit' , ( ) => { } ) ;
204
+ rstestProcess . on ( 'exit' , ( code , signal ) => {
205
+ logger . debug ( 'Worker process exited' , { code, signal } ) ;
206
+ } ) ;
190
207
}
191
208
192
209
public async createRstestWorker ( ) { }
0 commit comments