Skip to content

Commit 5f77bda

Browse files
committed
clean
1 parent 0098587 commit 5f77bda

File tree

10 files changed

+333
-218
lines changed

10 files changed

+333
-218
lines changed

e2e/scripts/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class Cli {
1111
public stdout = '';
1212
public stderr = '';
1313
private stdoutListeners: Array<() => void> = [];
14-
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: will use it
1514
private stderrListeners: Array<() => void> = [];
1615

1716
constructor(

e2e/test-coverage/fixtures/src/string.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ export const countWords = (str: string): number => {
2121

2222
export const truncate = (str: string, maxLength: number): string => {
2323
if (str.length <= maxLength) return str;
24-
return str.slice(0, maxLength - 3) + '...';
24+
return `${str.slice(0, maxLength - 3)}...`;
2525
};

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/logger.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export class Logger implements vscode.Disposable {
5050
}
5151

5252
public dispose() {
53-
this.disposables.forEach((disposable) => disposable.dispose());
53+
this.disposables.forEach((disposable) => {
54+
disposable.dispose();
55+
});
5456
this.channel.dispose();
5557
}
5658

packages/vscode/src/master.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import getPort from 'get-port';
55
import vscode from 'vscode';
66
import type { WebSocket } from 'ws';
77
import { WebSocketServer } from 'ws';
8-
8+
import { logger } from './logger';
99
import type {
1010
WorkerEvent,
1111
WorkerEventFinish,
1212
WorkerRunTestData,
1313
} from './types';
14-
import { logger } from './logger';
1514

1615
export class RstestApi {
1716
public ws: WebSocket | null = null;
@@ -137,6 +136,10 @@ export class RstestApi {
137136
const workerPath = path.resolve(__dirname, 'worker.js');
138137
const port = await getPort();
139138
const wsAddress = `ws://localhost:${port}`;
139+
logger.debug('Spawning worker process', {
140+
workerPath,
141+
wsAddress,
142+
});
140143
const rstestProcess = spawn('node', [...execArgv, workerPath], {
141144
stdio: 'pipe',
142145
env: {
@@ -148,19 +151,20 @@ export class RstestApi {
148151

149152
rstestProcess.stdout?.on('data', (d) => {
150153
const content = d.toString();
151-
logger.debug('🟢 worker', content.trimEnd());
154+
logger.debug('worker stdout', content.trimEnd());
152155
});
153156

154157
rstestProcess.stderr?.on('data', (d) => {
155158
const content = d.toString();
156-
logger.error('🔴 worker', content.trimEnd());
159+
logger.error('worker stderr', content.trimEnd());
157160
});
158161

159162
const server = createServer().listen(port).unref();
160163
const wss = new WebSocketServer({ server });
161164

162165
wss.once('connection', (ws) => {
163166
this.ws = ws;
167+
logger.debug('Worker connected', { wsAddress });
164168
const { cwd, rstestPath } = this.resolveRstestPath()[0];
165169
ws.send(
166170
JSON.stringify({
@@ -169,11 +173,21 @@ export class RstestApi {
169173
cwd,
170174
}),
171175
);
176+
logger.debug('Sent init payload to worker', { cwd, rstestPath });
172177

173178
ws.on('message', (_data) => {
174179
const _message = JSON.parse(_data.toString()) as WorkerEvent;
175180
if (_message.type === 'finish') {
176181
const message: WorkerEventFinish = _message;
182+
logger.debug('Received worker completion event', {
183+
id: message.id,
184+
testResultCount: Array.isArray(message.testResults)
185+
? message.testResults.length
186+
: undefined,
187+
testFileResultCount: Array.isArray(message.testFileResults)
188+
? message.testFileResults.length
189+
: undefined,
190+
});
177191
// Check if we have a pending promise for this test ID
178192
const promiseObj = this.testPromises.get(message.id);
179193
if (promiseObj) {
@@ -186,7 +200,9 @@ export class RstestApi {
186200
});
187201
});
188202

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

192208
public async createRstestWorker() {}

0 commit comments

Comments
 (0)