Skip to content

Commit a0edd8e

Browse files
committed
test(session): add version check, retry logic, and fix lint warnings
1 parent 5aac0f1 commit a0edd8e

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎package.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@
175175
}
176176
],
177177
"commands": [
178+
{
179+
"command": "r.liveShare.toggle",
180+
"title": "Toggle Live Share",
181+
"category": "R"
182+
},
183+
{
184+
"command": "r.liveShare.retry",
185+
"title": "Retry Live Share",
186+
"category": "R"
187+
},
178188
{
179189
"command": "r.workspaceViewer.refreshEntry",
180190
"title": "Manual Refresh",

‎sess/DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: sess
22
Type: Package
33
Title: Modern R IPC Server
4-
Version: 0.1.0
4+
Version: 3.0.0
55
Author: Gemini
66
Maintainer: Gemini <gemini@example.com>
77
Description: Implements a high-performance HTTP and WebSocket server for R Inter-Process Communication, replacing legacy file-system watchers. This package provides a generic protocol for IDEs and other clients to communicate with an R session.

‎src/test/suite/sessInstall.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,22 @@ suite('Sess Install Test Suite', () => {
7878

7979
assert.strictEqual(showMessageStub.called, false);
8080
});
81+
82+
test('sess package version matches extension version', () => {
83+
const packageJsonPath = path.join(extension_root, 'package.json');
84+
const descriptionPath = path.join(extension_root, 'sess', 'DESCRIPTION');
85+
86+
const packageJsonContent = util.readFileSyncSafe(packageJsonPath);
87+
const descriptionContent = util.readFileSyncSafe(descriptionPath);
88+
89+
assert.ok(packageJsonContent, 'package.json should be readable');
90+
assert.ok(descriptionContent, 'sess/DESCRIPTION should be readable');
91+
92+
const packageJson = JSON.parse(packageJsonContent) as { version: string };
93+
const match = descriptionContent.match(/^Version:\s*(.+)$/m);
94+
const sessVersion = match ? match[1] : undefined;
95+
96+
const baseVersion = packageJson.version.split('-')[0];
97+
assert.strictEqual(sessVersion, baseVersion, 'sess package version should match base extension version in package.json');
98+
});
8199
});

‎src/test/suite/session.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ suite('Session Communication', () => {
139139
const result = await rTerminal.createRTerm(true);
140140
assert.ok(result);
141141
await waitFor(() => session.activeSession, 15000, 200);
142+
const activeSession = session.activeSession;
143+
if (!activeSession) {
144+
throw new Error('activeSession is undefined');
145+
}
142146

143147
const term = rTerminal.rTerm;
144148
assert.ok(term, 'rTerminal.rTerm should be defined');
@@ -158,7 +162,7 @@ suite('Session Communication', () => {
158162
let svgliteResp: { data?: string, format?: string, error?: unknown } | undefined;
159163
await waitFor(async () => {
160164
try {
161-
svgliteResp = await session.sessionRequest(session.activeSession!.server, {
165+
svgliteResp = await session.sessionRequest(activeSession.server, {
162166
method: 'plot_latest',
163167
params: { width: 800, height: 600, format: 'svglite' }
164168
}) as { data?: string, format?: string, error?: unknown };
@@ -189,7 +193,7 @@ suite('Session Communication', () => {
189193
let pngResp: { data?: string, format?: string } | undefined;
190194
await waitFor(async () => {
191195
try {
192-
pngResp = await session.sessionRequest(session.activeSession!.server, {
196+
pngResp = await session.sessionRequest(activeSession.server, {
193197
method: 'plot_latest',
194198
params: { width: 800, height: 600, format: 'png' }
195199
}) as { data?: string, format?: string };

0 commit comments

Comments
 (0)