Skip to content

Commit 8261603

Browse files
committed
clean
1 parent 0098587 commit 8261603

File tree

5 files changed

+329
-210
lines changed

5 files changed

+329
-210
lines changed

packages/vscode/src/extension.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -231,34 +231,6 @@ class Rstest {
231231
}
232232
};
233233

234-
// const runTestQueue = async () => {
235-
// for (const { test, data } of queue) {
236-
// run.appendOutput(`Running ${test.id}\r\n`);
237-
// if (run.token.isCancellationRequested) {
238-
// run.skipped(test);
239-
// } else {
240-
// run.started(test);
241-
// await data.run(test, run, this.api);
242-
// }
243-
244-
// const lineNo = test.range!.start.line;
245-
// const fileCoverage = coveredLines.get(test.uri!.toString());
246-
// const lineInfo = fileCoverage?.[lineNo];
247-
// if (lineInfo) {
248-
// (lineInfo.executed as number)++;
249-
// }
250-
251-
// run.appendOutput(`Completed ${test.id}\r\n`);
252-
// }
253-
254-
// // TODO: support coverage in the future
255-
// // for (const [uri, statements] of coveredLines) {
256-
// // run.addCoverage(new MarkdownFileCoverage(uri, statements));
257-
// // }
258-
259-
// run.end();
260-
// };
261-
262234
discoverTests(request.include ?? gatherTestItems(this.ctrl.items))
263235
.then(() => run.end())
264236
.catch((error) => {
@@ -279,12 +251,6 @@ class Rstest {
279251

280252
return;
281253
}
282-
283-
// async initialize(context: vscode.ExtensionContext) {
284-
// context.subscriptions.push(
285-
// ...startWatchingWorkspace(this.ctrl, this.fileChangedEmitter),
286-
// );
287-
// }
288254
}
289255

290256
function getOrCreateFile(controller: vscode.TestController, uri: vscode.Uri) {

packages/vscode/src/master.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ export class RstestApi {
137137
const workerPath = path.resolve(__dirname, 'worker.js');
138138
const port = await getPort();
139139
const wsAddress = `ws://localhost:${port}`;
140+
logger.debug('Spawning worker process', {
141+
workerPath,
142+
wsAddress,
143+
});
140144
const rstestProcess = spawn('node', [...execArgv, workerPath], {
141145
stdio: 'pipe',
142146
env: {
@@ -148,19 +152,20 @@ export class RstestApi {
148152

149153
rstestProcess.stdout?.on('data', (d) => {
150154
const content = d.toString();
151-
logger.debug('🟢 worker', content.trimEnd());
155+
logger.debug('worker stdout', content.trimEnd());
152156
});
153157

154158
rstestProcess.stderr?.on('data', (d) => {
155159
const content = d.toString();
156-
logger.error('🔴 worker', content.trimEnd());
160+
logger.error('worker stderr', content.trimEnd());
157161
});
158162

159163
const server = createServer().listen(port).unref();
160164
const wss = new WebSocketServer({ server });
161165

162166
wss.once('connection', (ws) => {
163167
this.ws = ws;
168+
logger.debug('Worker connected', { wsAddress });
164169
const { cwd, rstestPath } = this.resolveRstestPath()[0];
165170
ws.send(
166171
JSON.stringify({
@@ -169,11 +174,21 @@ export class RstestApi {
169174
cwd,
170175
}),
171176
);
177+
logger.debug('Sent init payload to worker', { cwd, rstestPath });
172178

173179
ws.on('message', (_data) => {
174180
const _message = JSON.parse(_data.toString()) as WorkerEvent;
175181
if (_message.type === 'finish') {
176182
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+
});
177192
// Check if we have a pending promise for this test ID
178193
const promiseObj = this.testPromises.get(message.id);
179194
if (promiseObj) {
@@ -186,7 +201,9 @@ export class RstestApi {
186201
});
187202
});
188203

189-
rstestProcess.on('exit', () => {});
204+
rstestProcess.on('exit', (code, signal) => {
205+
logger.debug('Worker process exited', { code, signal });
206+
});
190207
}
191208

192209
public async createRstestWorker() {}

0 commit comments

Comments
 (0)